How to disable stack line chart
问题简述 (One-line summary)
There are four chart types we are using: line,bar, tile and stack (tiledbar, tiledline, stackedbar and stackedline). Can we remove the stackedline feature? That is to say if the chart is stack and the user clicks the line, it shows the tiledline.
在线图与柱图的相互转换中,怎样只显示三种图:柱图有平铺和堆积,线图只要堆积。也就是说把堆积线图显示成平铺线图?
多谢
版本及环境 (Version & Environment)
- ECharts 版本 (ECharts version):
- 浏览器类型和版本 (Browser version):
- 操作系统类型和版本 (OS Version):
重现步骤 (Steps to reproduce)
期望结果 (Expected behaviour)
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
option = {
}
其他信息 (Other comments)
自带的暂时做不到,可以扩展自定义 toolbox 实现
I find #2325 helps a lot. 如何在折线图中默认平铺模式而不是堆积模式? #2325 Inside the "change to line", set stack value to '' (see the code below). It will make change to line default is tiled no matter comes from tiled or stack. Also #3004 talks about the same thing. 堆积折线图 有bug #3004 The root reason behind is the common users are expecting the tiled line when click the line. Stack line is actually a bonus which most users are not aware of. So it's better to keep the feature but make tiled the default effect.
var seriesOptGenreator = { 'line': function (seriesType, seriesId, seriesModel, model) { if (seriesType === 'bar') { return zrUtil.merge({ id: seriesId, type: 'line', // Preserve data related option data: seriesModel.get('data'), stack:'', markPoint: seriesModel.get('markPoint'), markLine: seriesModel.get('markLine') }, model.get('option.line') || {}, true); } }, ....