echarts中折线图双Y轴

echarts中折线图双Y轴_第1张图片
option

option1 = {
  title: {
    text: '运动量对比',
    textStyle: {
      color: '#fff',
      fontSize: 14
    }
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    right: 5,
    textStyle: {
      color: 'white'
    },
    data: [
      { name: '步数', icon: 'rect' },
      { name: '运动量', icon: 'rect' },
    ]
  },
  grid: {
    left: '5%',
    bottom: '3%',
    right: '5%',
    containLabel: true
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    axisTick: { show: false },
    axisLabel: {
      textStyle: {
        color: "white", //刻度颜色
        fontSize: 8  //刻度大小
      }
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#0B3148',
        width: 1,
        type: 'solid'
      }
    },
    data: ['小班', '球班', '白班']
  },
  yAxis: [{
    name: '运动量',
    type: 'value',
    axisTick: { show: false },
    axisLabel: {
      textStyle: {
        color: "white", //刻度颜色
        fontSize: 8  //刻度大小
      }
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#fff',
        width: 1,
        type: 'solid',
      }
    },
    splitLine: {
      show: false
    },
  },
  {
    name: '步数',
    type: 'value',
    axisTick: { show: false },
    axisLabel: {
      textStyle: {
        color: "white", //刻度颜色
        fontSize: 8  //刻度大小
      }
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#fff',
        width: 1,
        type: 'solid'
      }
    },
    axisLabel: { formatter: '{value}k' },
    splitLine: {
      show: false
    },
  }

  ],
  series: [
    {
      name: '步数',
      type: 'line',
      smooth: true,
      itemStyle: {
        normal: {
          color: '#04FF9D'
        },
        lineStyle: {
          normal: {
            color: '#04FF9D',
            opacity: 1
          }
        }
      },
      data: [90000, 74641, 94000]
    },
    {
      name: '运动量',
      type: 'line',
      smooth: true,
      yAxisIndex: 1,
      itemStyle: {
        normal: {
          color: '#B25DFF'
        },
        lineStyle: {
          normal: {
            color: '#B25DFF',
            opacity: 1
          }
        }
      },
      data: [30, 50, 40]
    },
  ]
}

你可能感兴趣的:(echarts,前端,js)