echarts icon indicating copy to clipboard operation
echarts copied to clipboard

AxisProxy can throw typeErrors

Open DavidDecraene opened this issue 8 years ago • 1 comments

_percentWindow and _valueWindow can be null, in which case the slice call in their getters throws exceptions.

ERROR TypeError: Cannot read property 'slice' of undefined at Jk.getDataPercentWindow (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), :1:605008) at i.getPercentRange (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), :1:610712)

The responsible Code (https://github.com/ecomfe/echarts/blob/bf0df088c46ab958eb8bceff431906245712e217/src/component/dataZoom/AxisProxy.js )

/** * @return {Array.} Value can only be NaN or finite value. */ getDataValueWindow: function () { return this._valueWindow.slice(); },

/**
 * @return {Array.<number>}
 */
getDataPercentWindow: function () {
    return this._percentWindow.slice();
}

A suggested Alternative

/** * @return {Array.} Value can only be NaN or finite value. */ getDataValueWindow: function () { return this._valueWindow ? this._valueWindow.slice() : undefined; },

/**
 * @return {Array.<number>}
 */
getDataPercentWindow: function () {
    return this._percentWindow ? this._percentWindow.slice() : undefined;
}

DavidDecraene avatar Mar 22 '18 09:03 DavidDecraene

Fixed in eb1726fe6dce36b798a75303b43b3c0eca9f3518

100pah avatar Mar 24 '18 18:03 100pah