当前位置:网站首页>Echart line chart: multiple line charts show only one line at a time

Echart line chart: multiple line charts show only one line at a time

2022-06-13 06:07:00 HaanLen

Display multiple broken lines normally

 Insert picture description here

option = {
    
  xAxis: {
    
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  tooltip: {
    
    trigger: 'axis'
  },
  yAxis: {
    
    type: 'value'
  },
  series: [
    {
    
      data: [150, 230, 224, 218, 135, 147, 160],
      type: 'line',
      name: 'heeki'
    },
    {
    
      data: [110, 210, 224, 18, 135, 17, 260],
      type: 'line',
      name: 'DDDDD'
    },
    {
    
      data: [250, 20, 224, 18, 135, 77, 260],
      type: 'line',
      name: 'DDggDD'
    },
    {
    
      data: [150, 210, 424, 18, 135, 17, 230],
      type: 'line',
      name: 'DDyyD'
    },
    {
    
      data: [110, 210, 24, 18, 465, 177, 360],
      type: 'line',
      name: ' equally '
    }
  ]
};

Just click the legend to show the broken line , Show only one at a time

 Insert picture description here

 Insert picture description here

option = {
    
  xAxis: {
    
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  legend: {
    
    show: true,
    selectedMode: 'single'
  },
  tooltip: {
    
    trigger: 'axis'
  },
  yAxis: {
    
    type: 'value'
  },
  series: [
    {
    
      data: [150, 230, 224, 218, 135, 147, 160],
      type: 'line',
      name: 'heeki'
    },
    {
    
      data: [110, 210, 224, 18, 135, 17, 260],
      type: 'line',
      name: 'DDDDD'
    },
    {
    
      data: [250, 20, 224, 18, 135, 77, 260],
      type: 'line',
      name: 'DDggDD'
    },
    {
    
      data: [150, 210, 424, 18, 135, 17, 230],
      type: 'line',
      name: 'DDyyD'
    },
    {
    
      data: [110, 210, 24, 18, 465, 177, 360],
      type: 'line',
      name: ' equally '
    }
  ]
};

原网站

版权声明
本文为[HaanLen]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130603576879.html