echarts默认不显示部分折线,鼠标移动点击显示
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                echarts默认不显示部分折线,鼠标移动点击显示
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
                                需求:總共5條線,默認(rèn)只顯示3條,2條點擊才顯示
效果圖
只顯示3條,點擊這個legend 顯示這2條
?
代碼
?
?
Option = {tooltip: {trigger: 'axis',selectedMode: true },color: ['#66FFE5', '#FFD166', '#FF6666'],legend: {data: [{name: '工廠火災(zāi)',icon: 'circle'},{name: '自然災(zāi)害',icon: 'circle'},{name: '交通事故',icon: 'circle',},{name: '放汛防臺',icon: 'circle',},{name: '消防救援',icon: 'circle',},],selected: {'放汛防臺': false,'消防救援': false,},textStyle: { //圖例文字的樣式color: '#fff',fontSize: 14},itemHeight: 9,top: '5%',right: '5%',},xAxis: {type: 'category',boundaryGap: false,data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],},yAxis: {type: 'value',axisLabel: {formatter: '{value}',textStyle: {color: '#fff'}},splitLine: {show: true,lineStyle: {color: ['#165074'],width: 1,type: 'solid'}}},series: [{name: '放汛防臺',type: 'line',data: [250, 350, 220, 370, 300, 360, 260, 420, 310, 355, 375, 390],smooth: true,},{name: '消防救援',type: 'line',data: [200, 300, 170, 320, 250, 310, 210, 370, 260, 305, 225, 340],smooth: true,},{name: '交通事故',type: 'line',data: [150, 250, 120, 270, 200, 260, 160, 320, 210, 255, 175, 290],smooth: true},{name: '自然災(zāi)害',type: 'line',data: [100, 200, 70, 220, 150, 210, 110, 270, 160, 205, 125, 240],smooth: true},{name: '工廠火災(zāi)',type: 'line',data: [50, 150, 20, 170, 100, 160, 60, 220, 110, 155, 75, 190],smooth: true},]},?
總結(jié)
以上是生活随笔為你收集整理的echarts默认不显示部分折线,鼠标移动点击显示的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 【ReID】【代码注释】OSNet模型
- 下一篇: 图像透视变换应用
