gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1377
阅读:2886回复:0

如何设置echarts有 两条纵轴y轴值,且不同的项目用对应的纵轴y轴值

楼主#
更多 发布于:2021-11-25 10:05
xAxis: [
    {
      type: 'category',
      boundaryGap: true,
      data: categories
    },
    {
      type: 'category',
      boundaryGap: true,
      data: categories2
    }
  ],
  yAxis: [
    {
     type: 'value',
     scale: true,
     name: 'Price',
     max: 30,
     min: 0,
     boundaryGap: [0.2, 0.2]
   },
   {
     type: 'value',
     scale: true,
     name: 'Order',
     max: 1200,
     min: 0,
     boundaryGap: [0.2, 0.2]
   }
  ],


这样就有 两条纵轴



series: [
    {
      name: 'Dynamic Bar',
      type: 'bar',
      xAxisIndex: 1,  
     yAxisIndex: 1,   // 以右侧纵轴为标准
      data: data
    },
    {
      name: 'Dynamic Line',
      type: 'line',
     xAxisIndex: 0,      
     yAxisIndex: 0, // 以左侧纵轴为标准
      data: data2
    }
  ]


这样就分别用了 两条Y轴的值。
游客


返回顶部