How to hide a specific legend from multi-series fusionChart. Actually I want to remove a specific series from chart, when exporting I need to show that on excel sheet. So my plan is initial time hide from the chart then remove that legend from legend section.
I have used 'initiallyhidden' => 1, property, that time it will not shown in the chart. Now I want to remove that series name from legend also.
JSFiddle: http://jsfiddle.net/oL2u3vbd/1/
You can manipulate the categories within the datasource and dynamically change the chart's datasource when readying to export to excel. You just have to make sure to revert the change so it doesn't affect the visible chart.
document.getElementById("export").addEventListener("click", function() {
// december 2013 isn't shown but is included in excel export
let oldDataCategories = [...fusionData.dataSource.categories[0].category]
// Add Dec back to the categories && export
fusionData.dataSource.categories[0].category.push({ label: "Dec 2013" });
FusionCharts("myChartId").setChartData(fusionData.dataSource, 'json');
FusionCharts("myChartId").exportChart({ exportFormat: "csv" })
//revert categories back
fusionData.dataSource.categories[0].category = oldDataCategories;
console.log(fusionData.dataSource.categories[0].category)
FusionCharts("myChartId").setChartData(fusionData.dataSource, 'json');
});
Here is a example, You'll see there's not series for Dec. 2013 on the chart but when you export it that data is included.