Setting exportEnabled to true enables the export feature. It allows you to Print (v1.9.5 and above) or Save the Chart as JPEG / PNG formats. Export feature is available in all Chart Types.
Default: falsevar chart = new CanvasJS("container", { . . exportEnabled: true, . . }); chart.render();
Also See:
28 Comments
Pingback: CanvasJS v1.5 with Stock Charts, Range Charts & Export as Image Feature
i love CanvasJs
Is there a method to set the name of the exported chart rather than the default “Chart.jpg” or “Chart.png”?
We’ve added a new property “exportFileName” at the top level of options using which you can set exported chart’s name. You can download the internal build from here. Do let us know if it worked as expected.
Fantastic! Thank you. …and in reply to your question the answer is yes and no. “Save As” functionality instead of “Save” would be a better solution. As is I’ll have to update exportFileName every time new data is received. Else the user will have to rename the saved file after each save. Either way, again thank you for your excellent work.
Is it possible to save image without clicking button by just calling the function
because i need to create a PDFs file of number of charts . so i want a function that automatically create a PDFs of all charts . i am using asp.net mvc and javascript
We don’t have this option built into the chart. But with couple of lines of code you can do the same by using jsPDF. Here is an example.
As of now Charts can only be saved with the default name. But surely we will implented this feature in V1.5 GA.
I want To Do Cursor Axis Point Show……How to Do in Canvasjs …….Its Possible To Do?
This feature is nice, but when using with .net and firefox it was causing a postback. I had to add the following (this._menuButton.setAttribute(“type”,”button”)) so that it would not default to type “submit”.
Matt,
Thanks for reporting the issue, we will look into this.
This feature also doesn’t work in IE9. I get blob is undefined and according to the website blob is supported until IE10 https://developer.mozilla.org/en-US/docs/Web/API/Blob#Browser_compatibility
Is there a way to export the chart by executing a method instead of pressing the button?
Kyle,
It is not possible yet. But we will consider this in future versions.
Can I export multiple chart with one click ?
You can do so using toDataUrl. Please refer to following links:
1) http://weworkweplay.com/play/saving-html5-canvas-as-image/
2) http://jsfiddle.net/canvasjs/yqq9xxz9/
BTW, do you want save them as individual files or in one file ?
Thank you very much.
Hi, is it possible to export the data of chart instead of image?
You cannot do this via the CanvasJS API itself. But given that you have the JSON data, you should be able to construct these files in JavaScript and export the same using filesaver.
Hello,
how could I automatically record the graphic in a jpg file
thank you,
Best
As as now we don’t have a method to export chart – will be implementing in future versions.
But you can do the same with few lines of code. Here is an example.
Is it possible that when chart created its also auto create image and save on server. So i can view that in future, rather every time call logic for create chart.
Hi Guys,
Is a chart exportable to excel (not as an image; but as excel chart object) ? This will be a great feature if its already available. Please alert me if its done or if there is any suggestive alternative to achieve this.
Thank you,
Pruthvi
Pruthvi Kumar,
You can use libraries like excelbuilder or SheetJS to export as excel. But exporting charts as excel object is not supported but it can be inserted as image in excel file using those libraries.
Bootstrap makes that export button incredibly ugly. Any easy way to fix that? See http://www.abacharts.com for an example of the ugliness.
Hello,
Is possible to attach the chart to send an mail?
Thank you
Oliver,
You can export chart as image and attach it in mail, as scripting is not supported by email-clients.