Jim Baxter

Long Labels Causing Js Error In 3.2.2

Recommended Posts

Since upgrading to v3.2.2 (fusioncharts/3.2.2-release.3880), I can no longer render charts with Javascript that have long labels. In Firefox, the following is reported in my Firebug Javascript console:

 

T is undefined (FusionCharts.HC.js line 399)

 

Here is my JSON payload that is problematic:

 

var chartData = {
"chart" : {
	"showValues" : "1",
	"decimals" : "0",
	"numberSuffix" : "%",
	"showAlternateVGridColor" : "0",
	"bgAlpha" : "100",
	"bgColor" : "FFFFFF",
	"showBorder" : "0",
	"connectNullData" : "1",
	"lineThickness" : "1",
	"showValues" : "1",
	"formatNumberScale" : "0",
	"canvasBorderThickness" : "1", 
	"showAlternateVGridColor" : "0",
	"alternateHGridAlpha" : "40",
	"alternateHGridColor" : "",
	"chartRightMargin" : "50",
	"showPlotBorder" : "0",
	"showYAxisValues" : "1",
	"divLineAlpha" : "75",
	"divLineColor" : "cccccc",
	"divLineIsDashed" : "1",
	"plotSpacePercent" : "30",
	"yAxisMaxValue" : "100",
   	"maxLabelWidthPercent" : "30",
   	"canvasLeftMargin" : "300";
   	"yAxisName" : "xxx xxx"
},
"categories" : [{"category" : [{"label":"aaaaaaa, aaa aaaaaaaaa aaaa aaa aaaa aaa aaaaaaaaaaaa aa aaaa aaaaa-aaaa aaaaaaaaaa aaaaa?"}]}],
"dataset" : [{"seriesname":"Set One", "data":[{"value" : "10"}]}]
};

 

And here is a working data set:

 

var chartData = {
"chart" : {
	"showValues" : "1",
	"decimals" : "0",
	"numberSuffix" : "%",
	"showAlternateVGridColor" : "0",
	"bgAlpha" : "100",
	"bgColor" : "FFFFFF",
	"showBorder" : "0",
	"connectNullData" : "1",
	"lineThickness" : "1",
	"showValues" : "1",
	"formatNumberScale" : "0",
	"canvasBorderThickness" : "1", 
	"showAlternateVGridColor" : "0",
	"alternateHGridAlpha" : "40",
	"alternateHGridColor" : "",
	"chartRightMargin" : "50",
	"showPlotBorder" : "0",
	"showYAxisValues" : "1",
	"divLineAlpha" : "75",
	"divLineColor" : "cccccc",
	"divLineIsDashed" : "1",
	"plotSpacePercent" : "30",
	"yAxisMaxValue" : "100"
   	"maxLabelWidthPercent" : "30",
   	"canvasLeftMargin" : "300";
   	"yAxisName" : "xxx xxx"
},
"categories" : [{"category" : [{"label":"1"}]}],
"dataset" : [{"seriesname":"Set One", "data":[{"value" : "10"}]}]
};

 

All that has changed is the length of the category label. In Fusion Charts 3.2.1, the problematic data was working fine, although suffering from some of the known issues with Javascript surrounding things like wrapping (motivating factor for the upgrade).

 

The chart is generated in a div as follows:

 

<div id="comparisonChart" style="width: 1000px; height: 400px;"></div>

var chart = new FusionCharts("MSBar2D.swf", "chartId", "100%", "100%", 0, "0");
chart.setJSONData(chartData);
chart.setTransparent(true);
chart.render("comparisonChart");

 

Any thoughts? This seems to be an issue with the new label wrapping features in 3.2.2. The Flash charts render fine.

 

Thanks,

 

Jim

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum! smile.gif

 

Please note that Bar, Pie, Doughnut, Marimekko, Zoom Line and Multi-series Combination 3D charts do not apply the advanced label management rules. Also, you can opt not to apply the advanced label management to the X axis labels. For this, you would need to set the attribute labelDisplay='none' in <chart> element.

 

Ref: http://docs.fusioncharts.com/charts/?advanced/Adv_DataLabels.html

 

Hope this helps.

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