Reputation: 5902
Is there a way to enable exporting for a Stockchart? I know it is doable for a normal chart, but for a stock chart, I am getting undefined when try to enable the export mode,
I have tried: chart.export.enabled=true;
and chart.amExport.enabled = true;
and
var amExport = new AmCharts.AmExport();
amExport.enabled = true;
chart.export=amExport;
but all failed. Thanks
Upvotes: 3
Views: 1314
Reputation: 1
In addition to the above response to include the correct plugins, please ensure you are using html color codes such as "#FF0000" instead of "red" which is supported by earlier am chart export versions if you specify your own colors in the graph (graph.useDataSetColors = false) and valueaxis.
Export works fine whether you use the new JSON or the old style (I am still using the old style new AmCharts.AmStockChart() and $scope.chart.write("chartdiv");
Upvotes: 0
Reputation: 2297
Try to use the new initialization style of amCharts. See my answer to a question related to this.
It seems like the old approach you tried is not working anymore. (At least my few tests were not running)
To enable the export use this in the initialization code:
export: {
enabled: true,
position: "bottom-right"
}
And don't forget to include the needed export plugin!
A tutorial can be found here.
Take a look at this fiddle.
chart.export = {
enabled: true,
position: "bottom-right"
}
chart.initHC = false;
chart.validateNow();
The key is to set initHC
to false, because else it wont load the handler for the plugin. Then just validate again, add some pixie dust and tadaa - it works.
Upvotes: 4