颜色代码遍历的错误
代码:
//以防定义的颜色数组不够用
if(index > barLinearGradient.length) index = index % barLinearGradient.length;
var color1 = barLinearGradient[index][0];
var color2 = barLinearGradient[index][1];
错误提示:
Uncaught TypeError: Cannot read property '0' of undefined
at initialize.resetLinearGradient (Bar.js:340)
at initialize.resetLocation (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:1389947)
at initialize.drawCharts (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:1376507)
at initialize.redrawThematicFeatures (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:1375194)
at initialize.moveTo (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:1363108)
at initialize.moveTo (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:53447)
at initialize.setCenter (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:48968)
at initialize.wheelChange (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:235037)
at initialize.wheelDown (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:235181)
at initialize.callback (eval at <anonymous> (SuperMap-8.1.1-14426.js:3), <anonymous>:1:186366)