diff --git a/src/core/echarts.ts b/src/core/echarts.ts index 3724b48af5..7775e6d504 100644 --- a/src/core/echarts.ts +++ b/src/core/echarts.ts @@ -112,7 +112,7 @@ import { import Displayable from 'zrender/src/graphic/Displayable'; import { seriesSymbolTask, dataSymbolTask } from '../visual/symbol'; import { getVisualFromData, getItemVisualFromData } from '../visual/helper'; -import { deprecateLog, deprecateReplaceLog, error } from '../util/log'; +import { deprecateLog, deprecateReplaceLog, error, warn } from '../util/log'; import { handleLegacySelectEvents } from '../legacy/dataSelectAction'; import { registerExternalTransform } from '../data/helper/transform'; @@ -137,8 +137,6 @@ declare let global: any; type ModelFinder = modelUtil.ModelFinder; -const hasWindow = typeof window !== 'undefined'; - export const version = '5.4.0'; export const dependencies = { @@ -417,7 +415,7 @@ class ECharts extends Eventful { if (__DEV__) { const root = ( /* eslint-disable-next-line */ - hasWindow ? window : global + env.hasGlobalWindow ? window : global ) as any; defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer; @@ -705,7 +703,7 @@ class ECharts extends Eventful { getDevicePixelRatio(): number { return (this._zr.painter as CanvasPainter).dpr /* eslint-disable-next-line */ - || (hasWindow && window.devicePixelRatio) || 1; + || (env.hasGlobalWindow && window.devicePixelRatio) || 1; } /** @@ -974,7 +972,7 @@ class ECharts extends Eventful { } else { if (__DEV__) { - console.warn(key + ': ' + (view + warn(key + ': ' + (view ? 'The found component do not support containPoint.' : 'No view mapping to the found component.' )); @@ -983,7 +981,7 @@ class ECharts extends Eventful { } else { if (__DEV__) { - console.warn(key + ': containPoint is not supported'); + warn(key + ': containPoint is not supported'); } } }, this); @@ -1018,7 +1016,7 @@ class ECharts extends Eventful { if (__DEV__) { if (!seriesModel) { - console.warn('There is no specified seires model'); + warn('There is no specified series model'); } } @@ -1113,7 +1111,7 @@ class ECharts extends Eventful { // be missed, otherwise there is no way to distinguish source component. // See `dataFormat.getDataParams`. if (!isGlobalOut && !(model && view)) { - console.warn('model or view can not be found by params'); + warn('model or view can not be found by params'); } } @@ -1304,7 +1302,7 @@ class ECharts extends Eventful { this.hideLoading(); if (!loadingEffects[name]) { if (__DEV__) { - console.warn('Loading effects ' + name + ' not exists.'); + warn('Loading effects ' + name + ' not exists.'); } return; } @@ -1582,7 +1580,7 @@ class ECharts extends Eventful { // If dispatchAction before setOption, do nothing. ecModel && ecModel.eachComponent(condition, function (model) { - const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) !== null; + const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null; if (isExcluded) { return; }; @@ -1626,7 +1624,7 @@ class ECharts extends Eventful { }, ecIns); ecModel && ecModel.eachComponent(condition, function (model) { - const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) !== null; + const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null; if (isExcluded) { return; }; @@ -1863,7 +1861,7 @@ class ECharts extends Eventful { } if (__DEV__) { - console.warn( + warn( 'No coordinate system that supports ' + methodName + ' found by the given finder.' ); } @@ -2594,7 +2592,7 @@ const MOUSE_EVENT_NAMES: ZRElementEventName[] = [ function disposedWarning(id: string): void { if (__DEV__) { - console.warn('Instance ' + id + ' has been disposed'); + warn('Instance ' + id + ' has been disposed'); } } @@ -2655,7 +2653,7 @@ export function init( const existInstance = getInstanceByDom(dom); if (existInstance) { if (__DEV__) { - console.warn('There is a chart instance already initialized on the dom.'); + warn('There is a chart instance already initialized on the dom.'); } return existInstance; } @@ -2668,7 +2666,7 @@ export function init( || (!dom.clientHeight && (!opts || opts.height == null)) ) ) { - console.warn('Can\'t get DOM width or height. Please check ' + warn('Can\'t get DOM width or height. Please check ' + 'dom.clientWidth and dom.clientHeight. They should not be 0.' + 'For example, you may need to call this in the callback ' + 'of window.onload.');