exportChart(Object options)

exportChart method lets you export StockChart as image (jpg or png) programmatically.

By default, StockChart is exported in png format, if format not given.

Parameters:
        options:
         {
             format: String (“jpg” | “png”),
             toDataURL: Boolean (default false),
             fileName: String
         }

Example: stockChart.exportChart({ format: “jpg” });
Note:
  • StockChart should be rendered before you can use exportChart method.
var stockChart = new CanvasJS.StockChart("container",
{
 .
 .
 .
 .
});
stockChart.render();

stockChart.exportChart({ format: "jpg" });

Try Editing The Code


If you have any questions, please feel free to ask in our forums.Ask Question