Can I save chart as image without toolbox interaction in Echarts?

Viewed 10821

I'd like to save an echart as an image. If the toolbox.saveAsImage option is set to true, I can use a toolbox action to save the chart. However, I'm wondering if this can be done programmatically?

2 Answers

If you have echart instance variable, use getDataURL method with params like this:

echartInstance.getDataURL({
    pixelRatio: 2,
    backgroundColor: '#fff'
});

Calling e.getDataURL() without options won't work.

Related