How to use the setCanvasCreator function from echarts

Find comprehensive JavaScript echarts.setCanvasCreator code examples handpicked from public code repositorys.

75
76
77
78
79
80
81
82
83
84
  ...option
};
this.aniDuration = option.animationDurationUpdate;

const canvasCreator = this.createCanvas(128, 128);
echarts.setCanvasCreator(() => canvasCreator);

this.option = option;
this.chart = echarts.init(this.canvas, theme);
this.fixZRender(); // 必须放在setOption之前
fork icon320
star icon100
watch icon3

+ 3 other calls in file

108
109
110
111
112
113
114
115
116
117
}

initECahrts() {
  const [width, height] = this.getWH();
  const ctx = createCanvas(128, 128);
  echarts.setCanvasCreator(() => ctx);

  const { theme, option } = this;
  const canvas = createCanvas(width, height);
  const chart = echarts.init(canvas, theme);
fork icon320
star icon0
watch icon0

9
10
11
12
13
14
15
16
17
18
generateImage (options, savePath, size) {
    return new Promise((resolve, reject) => {
        const canvas = createCanvas(400, 200);
        const ctx = canvas.getContext('2d');
        ctx.font = '12px 楷体';
        echarts.setCanvasCreator(function () {
            return canvas;
        });
        const chart = echarts.init(canvas);
        options.animation = false;
fork icon12
star icon28
watch icon1