Skip to content
Merged
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
30 changes: 14 additions & 16 deletions src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 = {
Expand Down Expand Up @@ -417,7 +415,7 @@ class ECharts extends Eventful<ECEventDefinition> {
if (__DEV__) {
const root = (
/* eslint-disable-next-line */
hasWindow ? window : global
env.hasGlobalWindow ? window : global
) as any;

defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;
Expand Down Expand Up @@ -705,7 +703,7 @@ class ECharts extends Eventful<ECEventDefinition> {
getDevicePixelRatio(): number {
return (this._zr.painter as CanvasPainter).dpr
/* eslint-disable-next-line */
|| (hasWindow && window.devicePixelRatio) || 1;
|| (env.hasGlobalWindow && window.devicePixelRatio) || 1;
}

/**
Expand Down Expand Up @@ -974,7 +972,7 @@ class ECharts extends Eventful<ECEventDefinition> {
}
else {
if (__DEV__) {
console.warn(key + ': ' + (view
warn(key + ': ' + (view
? 'The found component do not support containPoint.'
: 'No view mapping to the found component.'
));
Expand All @@ -983,7 +981,7 @@ class ECharts extends Eventful<ECEventDefinition> {
}
else {
if (__DEV__) {
console.warn(key + ': containPoint is not supported');
warn(key + ': containPoint is not supported');
}
}
}, this);
Expand Down Expand Up @@ -1018,7 +1016,7 @@ class ECharts extends Eventful<ECEventDefinition> {

if (__DEV__) {
if (!seriesModel) {
console.warn('There is no specified seires model');
warn('There is no specified series model');
}
}

Expand Down Expand Up @@ -1113,7 +1111,7 @@ class ECharts extends Eventful<ECEventDefinition> {
// 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');
}
}

Expand Down Expand Up @@ -1304,7 +1302,7 @@ class ECharts extends Eventful<ECEventDefinition> {
this.hideLoading();
if (!loadingEffects[name]) {
if (__DEV__) {
console.warn('Loading effects ' + name + ' not exists.');
warn('Loading effects ' + name + ' not exists.');
}
return;
}
Expand Down Expand Up @@ -1582,7 +1580,7 @@ class ECharts extends Eventful<ECEventDefinition> {

// 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;
};
Expand Down Expand Up @@ -1626,7 +1624,7 @@ class ECharts extends Eventful<ECEventDefinition> {
}, 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;
};
Expand Down Expand Up @@ -1863,7 +1861,7 @@ class ECharts extends Eventful<ECEventDefinition> {
}

if (__DEV__) {
console.warn(
warn(
'No coordinate system that supports ' + methodName + ' found by the given finder.'
);
}
Expand Down Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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.');
Expand Down