You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
运行时会报错:TypeError: Cannot read property 'length' of undefined
是在lib/data/list.js文件内的listProto.downSample函数出错,第900行
listProto.downSample=function(dimension,rate,sampleValue,sampleIndex){varlist=cloneListForMapAndSample(this,[dimension]);varstorage=this._storage;vartargetStorage=list._storage;varoriginalIndices=this.indices;varindices=list.indices=[];varframeValues=[];varframeIndices=[];varframeSize=Math.floor(1/rate);vardimStore=targetStorage[dimension];varlen=this.count();// Copy data from original datafor(vari=0;i<storage[dimension].length;i++){// <======就是这句targetStorage[dimension][i]=storage[dimension][i];}
function_default(seriesType,ecModel,api){ecModel.eachSeriesByType(seriesType,function(seriesModel){vardata=seriesModel.getData();varsampling=seriesModel.get('sampling');varcoordSys=seriesModel.coordinateSystem;// Only cartesian2d support down samplingif(coordSys.type==='cartesian2d'&&sampling){varbaseAxis=coordSys.getBaseAxis();varvalueAxis=coordSys.getOtherAxis(baseAxis);// <====该函数返回的就是valueAxis.dimvarextent=baseAxis.getExtent();// Coordinste system has been resizedvarsize=extent[1]-extent[0];varrate=Math.round(data.count()/size);if(rate>1){varsampler;if(typeofsampling==='string'){sampler=samplers[sampling];}elseif(typeofsampling==='function'){sampler=sampling;}if(sampler){data=data.downSample(valueAxis.dim,1/rate,sampler,indexSampler);// 调用参数不对seriesModel.setData(data);}}}},this);}
上面注释的那句调用data.downSample函数的第一个参数valueAxis.dim有问题,其值为"Y" var valueAxis = coordSys.getOtherAxis(baseAxis);直接把valueAxis.dim赋值为"Y" lib/coord/cartesian/Cartesian2D.js第75行
/** * Get other axis * @param {module:echarts/coord/cartesian/Axis2D} axis */
getOtherAxis: function(axis){returnthis.getAxis(axis.dim==='x' ? 'y' : 'x');}
One-line summary [问题简述]
无法使用
series.sampling
选项, 使用后就会抛出异常Version & Environment [版本及环境]
另外我是在electron环境里运行的,electron版本:1.8.3
Expected behaviour [期望结果]
可以正常使用
series.sampling
选项ECharts option [ECharts配置项]
Other comments [其他信息]
运行时会报错:TypeError: Cannot read property 'length' of undefined
是在
lib/data/list.js
文件内的listProto.downSample
函数出错,第900行上面的
storage[dimension].length
里dimension
是"Y"
,但是storage
里只有{theta: [], h: [], v: [], p: []}
也就是说
dimension
应该是"h"
而不是"Y"
。The text was updated successfully, but these errors were encountered: