We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
series类型为lines的数据,其value为0时,即使visualMap定义包含0,也不会被正确着色。 请直接访问线上实例。可以看到即使关闭所有图例显示,值为0的暗红色线条依然存在。 http://gallery.echartsjs.com/editor.html?c=xB1pdCBgex
定义visualMap:
visualMap: { type: "piecewise", left: 'right', min: 0, max: 15, splitNumber: 5, color: ['red', 'yellow', 'green'] },
或者
visualMap: { type: "piecewise", pieces: [ {min: 15}, // 不指定 max,表示 max 为无限大(Infinity)。 {min: 12, max: 15}, {min: 9, max: 12}, {min: 6, max: 9}, {min: 3, max: 6}, {max: 3} // 不指定 min,表示 min 为无限大(-Infinity)。 ], left: 'right', color: ['red', 'yellow', 'green'] },
定义series[0].data,例如:
{ value:0, coords:[...] }
值为0的折线被绘制成绿色。 实际效果是值为0的折线在默认主题下绘制成暗红色。 而且仅当值为0的时候出现此情况,若value为字符串的"0"则显示正常。 官网例子使用scatter绘制,value为Number类型也显示正常。
可能是空值判断不严谨。
var uploadedDataURL = "/asset/get/s/data-1477626617822-SJMboHgel.txt"; function convertData(sourceData) { return [].concat.apply([], $.map(sourceData, function(busLine, index) { var prevPoint = null; var points = []; var value = busLine.shift(); for (var i = 0; i < busLine.length; i += 2) { var point = [busLine[i], busLine[i + 1]]; if (i > 0) { point = [ prevPoint[0] + point[0], prevPoint[1] + point[1] ]; } prevPoint = point; points.push([point[0] / 1e5, point[1] / 1e5]); } return { value: value, coords: points }; })); } var option = { bmap: { roam: true }, visualMap: { type: "piecewise", pieces: [{ min: 15 }, // 不指定 max,表示 max 为无限大(Infinity)。 { min: 12, max: 15 }, { min: 9, max: 12 }, { min: 6, max: 9 }, { min: 3, max: 6 }, { max: 3 } // 不指定 min,表示 min 为无限大(-Infinity)。 ], left: 'right', // min: 0, // max: 15, // splitNumber: 5, color: ['red', 'yellow', 'green'] }, tooltip: { formatter: function(params, ticket, callback) { return "拥堵指数:" + params.value; }, trigger: 'item' }, series: [{ type: 'lines', coordinateSystem: 'bmap', polyline: true, lineStyle: { normal: { opacity: 1, width: 4 }, emphasis: { width: 6 } }, effect: { show: true, symbolSize: 2, color: "white" } }] }; $.getJSON(uploadedDataURL, function(rawData) { option.series[0].data = convertData(rawData); myChart.setOption(option); // console.log(option); //获取echart中使用的bmap实例 var map = myChart.getModel().getComponent('bmap').getBMap(); map.disableDoubleClickZoom(); map.centerAndZoom("嘉兴", 13); });
请直接访问线上实例。可以看到即使关闭所有图例显示,值为0的暗红色线条依然存在。 http://gallery.echartsjs.com/editor.html?c=xB1pdCBgex
The text was updated successfully, but these errors were encountered:
另外,定义pieces的时候需要手动指定所有区间,而min、max、splitNumber组合可以自动生成区间。 平时更常用更习惯的使用方式是后者,但是,如果数据中存在value数值超过了max,这个点或者线就不会被上色,只会以透明表现,而不是使用最接近max的颜色。 希望能有一个配置项,开启后大于max的值用最大区间的色彩表示,min同理。
Sorry, something went wrong.
Fix lines zero data not handle right. #4346
d1b29ee
已修复第一个问题
[visualMap] #4346 introduce minOpen, maxOpen, syntactic sugar for inc…
b7af985
…luding -Infinity or Inifinity when using `splitNumber`.
第二个问题,加了个配置。
No branches or pull requests
问题简述 (One-line summary)
series类型为lines的数据,其value为0时,即使visualMap定义包含0,也不会被正确着色。
请直接访问线上实例。可以看到即使关闭所有图例显示,值为0的暗红色线条依然存在。
http://gallery.echartsjs.com/editor.html?c=xB1pdCBgex
版本及环境 (Version & Environment)
重现步骤 (Steps to reproduce)
定义visualMap:
或者
定义series[0].data,例如:
期望结果 (Expected behaviour)
值为0的折线被绘制成绿色。
实际效果是值为0的折线在默认主题下绘制成暗红色。
而且仅当值为0的时候出现此情况,若value为字符串的"0"则显示正常。
官网例子使用scatter绘制,value为Number类型也显示正常。
可能哪里有问题 (What went wrong)
可能是空值判断不严谨。
ECharts配置项 (ECharts option)
其他信息 (Other comments)
请直接访问线上实例。可以看到即使关闭所有图例显示,值为0的暗红色线条依然存在。
http://gallery.echartsjs.com/editor.html?c=xB1pdCBgex
The text was updated successfully, but these errors were encountered: