Sign in to follow this  
JustMe2

Multi-Drill Down With Json

Recommended Posts

I am trying to get a multi-drill down to work with JSON data and cannot get it to work. It works fine with XML. Below is a sample on the test JSON I have. The main chart shows but when you click on an item to drill down you get a message "No Data to Display"

 

Can anyone be of assistance?

 

var chartdata4 = {
"chart": {
	"caption": " ",
	"subcaption":"", 
	"xaxisname":"Year", 
	"yaxisname":"Frequency",
	"palette": "1",
	"rotatenames": "0",
	"animation": "1",
	"numdivlines": "4",
	"basefont": "Arial",
	"basefontsize": "12",
	"useroundedges": "1",
	"legendborderalpha": "0"
},
"categories": [
	{"font": "Arial", "fontsize": "12",	"category": [
		{"label": "2011"},
		{"label": "2012"}
	]}
],
"dataset": [
	{"seriesname": "LOC-A", "alpha": "90", "showvalues": "0", "data": [
		{"value": "30", "link":"newchart-json-2011-quarterly.json"},
		{"value": "26", "link":"newchart-json-2012-quarterly.json"}
	]},
	{"seriesname": "LOC-B", "showvalues": "0", "alpha": "90", "data": [
		{"value": "27", "link":"newchart-json-2011-quarterly.json"},
		{"value": "25", "link":"newchart-json-2012-quarterly.json"}
	]},
	{"seriesname": "Company Trend", "renderas": "Line", "data": [
		{"value": "27"},
		{"value": "25"}
	]},
	{"seriesname": "Department Trend", "renderas": "Line", "data": [
		{"value": "30"},
		{"value": "26"}
	]}
],
 "linkeddata":[{
	"id":"2011-quarterly", 
	"linkedcharts":{
		"chart": {
			"caption": " ",
			"subcaption":"", 
			"xaxisname":"2011 Quarterly", 
			"yaxisname":"Frequency",
			"palette": "1",
			"rotatenames": "0",
			"animation": "1",
			"numdivlines": "4",
			"basefont": "Arial",
			"basefontsize": "12",
			"useroundedges": "1",
			"legendborderalpha": "0"
		},
		"categories": [
			{"font": "Arial", "fontsize": "12",	"category": [
				{"label": "Q1"},
				{"label": "Q2"},
				{"label": "Q3"},
				{"label": "Q4"}
			]}
		],
		"dataset": [
			{"seriesname": "LOC-A", "alpha": "90", "showvalues": "0", "data": [
				{"value": "10", "link":"newchart-json-2011-monthly.json"},
				{"value": "7", "link":"newchart-json-2011-monthly.json"},
				{"value": "8", "link":"newchart-json-2011-monthly.json"},
				{"value": "5", "link":"newchart-json-2011-monthly.json"}
			]},
			{"seriesname": "LOC-B", "showvalues": "0", "alpha": "90", "data": [
				{"value": "6", "link":"newchart-json-2011-monthly.json"},
				{"value": "4", "link":"newchart-json-2011-monthly.json"},
				{"value": "12", "link":"newchart-json-2011-monthly.json"},
				{"value": "5", "link":"newchart-json-2011-monthly.json"}
			]},
			{"seriesname": "Company Trend", "renderas": "Line", "data": [
				{"value": "10"},
				{"value": "7"},
				{"value": "8"},
				{"value": "5"}
			]},
			{"seriesname": "Department Trend", "renderas": "Line", "data": [
				{"value": "6"},
				{"value": "4"},
				{"value": "12"},
				{"value": "5"}
			]}
		]
	},
	"id":"2012-quarterly", "linkedcharts":{
		"chart": {
			"caption": " ",
			"subcaption":"", 
			"xaxisname":"2012 Quarterly", 
			"yaxisname":"Frequency",
			"palette": "1",
			"rotatenames": "0",
			"animation": "1",
			"numdivlines": "4",
			"basefont": "Arial",
			"basefontsize": "12",
			"useroundedges": "1",
			"legendborderalpha": "0"
		},
		"categories": [
			{"font": "Arial", "fontsize": "12",	"category": [
				{"label": "Q1"},
				{"label": "Q2"},
				{"label": "Q3"},
				{"label": "Q4"}
			]}
		],
		"dataset": [
			{"seriesname": "LOC-A", "alpha": "90", "showvalues": "0", "data": [
				{"value": "8", "link":"newchart-json-2012-monthly.json"},
				{"value": "3", "link":"newchart-json-2012-monthly.json"},
				{"value": "7", "link":"newchart-json-2012-monthly.json"},
				{"value": "8", "link":"newchart-json-2012-monthly.json"}
			]},
			{"seriesname": "LOC-B", "showvalues": "0", "alpha": "90", "data": [
				{"value": "11", "link":"newchart-json-2012-monthly.json"},
				{"value": "4", "link":"newchart-json-2012-monthly.json"},
				{"value": "6", "link":"newchart-json-2012-monthly.json"},
				{"value": "4", "link":"newchart-json-2012-monthly.json"}
			]},
			{"seriesname": "Company Trend", "renderas": "Line", "data": [
				{"value": "8"},
				{"value": "3"},
				{"value": "7"},
				{"value": "8"}
			]},
			{"seriesname": "Department Trend", "renderas": "Line", "data": [
				{"value": "11"},
				{"value": "4"},
				{"value": "6"},
				{"value": "4"}
			]}
		]
	}
}]
}

Share this post


Link to post
Share on other sites

Here is the code we are using to call the chart:

 

var rootChart = new FusionCharts( "Charts/MSCombi2D.swf", "myChartId", "100%", "100%", "0", "1" );
   rootChart.setJSONData(chartdata4);
   rootChart.render( "chartContainer" );

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

With regard to your issue,

 

Could you please,

 

1. Remove the .json extension from the drill down link and provide only the id, as shown below:

 

Incorrect code:

{"value": "30", "link":"newchart-json-2011-quarterly.json"}

 

Correct Code:

{"value": "30", "link":"newchart-json-2011-quarterly"}

 

2. Replace "linkedcharts" with "linkedchart" for "2012-quarterly" linkeddata, as you are using Multiple levels of drilldown.

 

Hope this helps!

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Thank you for your response.

 

Please do let us know if we could be of any further help.

 

Happy FusionCharting.:D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this