While exporting any chart, “Chart” is used as the default file name with corresponding extension “jpg” or “png”. You can override this name using exportFileName property.
Default: Chartvar chart = new CanvasJS("container", { . . exportFileName: "Range Area", . . }); chart.render();
Also See:
21 Comments
Pingback: CanvasJS Charts 1.5 goes GA - CanvasJS
How does one change the exportFileName dynamically? I’ve tried chart.options.exportFileName = “new name”; and that has no effect even though alert(chart.options.exportFileName) shows me the original name.
After updating any property (suggested to do in batches) you need to call chart.render() method. This internally updates the properties that have changed.
Ok, what is the solution… I tried:
function doChange() {
chart.options.title.text = “test”;
chart.options.exportFileName = “test”;
chart.render();
}
Changing the “title” works. What am I missing on the “exportFileName”?
Hi, I am really excited using canvasjs. I’d just like to know if I can add new formats to export(example: csv, xls, txt, ….) if I can, can you let me know how?
Jorge,
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.
The following simply doesn’t work when attempting to change the export file name…
var chart;
window.onload = function () {
chart = new CanvasJS.Chart(“chartContainer”,
{
title: {
text: “Overriding Default Export File Name”
},
exportFileName: “Range Spline Area”, //Give any name accordingly
exportEnabled: true,
axisY: {
includeZero: false,
},
axisX: {
interval: 10
},
data: [
{
type: “rangeSplineArea”,
dataPoints: [
{ x: 10, y: [18.86, 40.76] },
{ x: 20, y: [55.95, 78.26] },
{ x: 30, y: [48.27, 72.90] },
{ x: 40, y: [67.65, 99.65] },
{ x: 50, y: [25.50, 51.26] }
]
}
]
});
chart.render();
}
function doclick() {
chart.options.title.text = “New Title”;
chart.options.exportFileName = “NewFileName”;
chart.render();
}
Change Stuff
Dave,
We have fixed this issue in v1.5.6, please download the same.
is it possible to save it as pdf if its not in library how to do it with javascript or jquery
Hi,
As of now this feature is not available so you might use jsPDf for the same.
can we export it to doc format
Varun,
We haven’t tried this ourselves, but you can try exporting using libraries like docx.js. We have an example which exports to pdf using jsPDF library – this should give you some ideas.
is there an option where I can position the exportButton and not in the upper right?
Vianece,
As of now It is not Possible.
PNG is good but SVG or something scalable would be excellent. Is that
Hi,
is it possible to use canvas.toDataURL direct in the script, while the export button is disabled?
christian,
Please refer this example.
How can I export the graph from canvasJS to Excel and word? Thanks
victor,
We have an example for exporting charts to PDF format using jsPDF. Similarly you can try exporting to word format using docx.js
Hi,
Is it possible to switch the backgroundcolor to normal in case of saving the picture?
My page design is darkgrey, but for the export it looks a bit weird.
Thanks!
Ambrosius
Ambrosius,
This feature is not available yet.