Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export interface SetOptionOpts {
export interface ResizeOpts {
width?: number | 'auto', // Can be 'auto' (the same as null/undefined)
height?: number | 'auto', // Can be 'auto' (the same as null/undefined)
devicePixelRatio?: number,
animation?: AnimationOption
silent?: boolean // by default false.
};
Expand Down Expand Up @@ -1364,7 +1365,14 @@ class ECharts extends Eventful<ECEventDefinition> {
return;
}

this._zr.resize(opts);
// Default to use window.devicePixelRatio to handle browser zoom changes.
const zrResizeOpts = opts ? extend({}, opts) : {};
if (zrResizeOpts.devicePixelRatio == null && env.hasGlobalWindow) {
/* eslint-disable-next-line */
zrResizeOpts.devicePixelRatio = window.devicePixelRatio;
}

this._zr.resize(zrResizeOpts);

const ecModel = this._model;

Expand Down