Echarts雙y軸折線圖


 
     option = {
  color: ["#e57e1f", "#666666", "#4c6291"],//線條顏色
    title: {
        //text: 'Step Line'
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
       data: ["電流", "BMS1", "BMS2"],
            orient: "vertical",
           x: "left",
           y: "center",
           icon: "rect",
           align: "left",
    },
    grid: {
       left: "15%",
          right: "8%",
          bottom: "12%",
          containLabel: true,
    },
    toolbox: {
        show: false,
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
         boundaryGap: false,
        data: times,
            splitLine: {
             show: true,
           },
           axisTick: {
             show: false,
           },
            axisLabel: {
             rotate: 90,
           },
    },
      yAxis: [
           {
             scale: true,
             type: "value",
             name: "單位:A",
             axisTick: {
               show: false,
             },
             max: 70,
             min: -10,
             splitNumber: 9,
           },
           {
             scale: true,
             type: "value",
             name: "單位:℃",
             axisTick: {
               show: false,
               alignWithLabel: true,
             },
             max: 50,
             min: 10,
             splitNumber: 9,
           },
         ],
      dataZoom: [ //滾動條
           {
             show: true,
             realtime: true,
             start: 0,
             end: 100,
           },
           {
             type: "inside",
             realtime: true,
             tart: 0,
             end: 100,
           },
         ],
    series: [
       {
            name: '電流',
            type: 'line',
            //step: 'start',
             symbol: "none",
             data: currentCapacity,
             yAxisIndex:0,
              markLine: {
              symbol: ["none", "none"],
              lineStyle: {
                normal: {
                  type: "solid",
                  color: "red",
                  width:2
                },
              },
              label: {
                normal: {
                  show: true,
                  formatter: "某一時間",
                },
              },
              itemStyle: {
                normal: {
                  color: "red",
                },
              },
              data: [{ name: "某一時間點", xAxis: faultTime }],
            },
        },
        {
            name: 'BMS1',
            type: 'line',
            //step: 'start',
             symbol: "none",
            data: bmsTemp1,
            yAxisIndex:1
        },
         {
            name: 'BMS2',
            type: 'line',
            //step: 'start',
             symbol: "none",
            data: bmsTemp2,
            yAxisIndex:1
        },
       
    ]
};
     
     
    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM