简体   繁体   English

echarts中数据和标记线之间的切换

[英]toggle between data and markline in echarts

Given the scatter series with markline in echarts as below :鉴于 echarts 中带有标记线的散点序列如下:

option = {
    xAxis: {},
    yAxis: {},
    series: [{
        symbolSize: 20,
        data: [
            [10.0, 8.04],
            [8.0, 6.95],
            [13.0, 7.58],
            [9.0, 8.81],
            [11.0, 8.33],
            [14.0, 9.96],
            [6.0, 7.24],
            [4.0, 4.26],
            [12.0, 10.84],
            [7.0, 4.82],
            [5.0, 5.68]
        ],
        type: 'scatter',
        markLine: {
            data: [
                {name: 'average',
                type: 'average',
                valueIndex: 0}
            ]
        }
    }]
};

I wanted to toggle between data and markline.我想在数据和标记线之间切换。 Lets say when markline off , only scattered data should be shown.假设当标记线关闭时,只应显示分散的数据。 And when markline on only markline should be shown in the graph.并且当只应在图中显示标记线上的标记线时。

I think it should work when you simply set the e-chart option accordingly:我认为当您相应地设置电子图表选项时它应该可以工作:

  • when you only want to show the markline, set the symbol for each data-item to none当您只想显示标记线时,将每个数据项的符号设置为none
  • when you only want to show the data, markLine can be undefined (or set symbol for each markline to none )当您只想显示数据时,可以undefined markLine (或将每个标记线的符号设置为none

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM