Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ECharts: Multiple series (lines) with own yAxis

Tags:

echarts

I want to switch from Highcharts to ECharts (preferably 3), but my current graphs have multiple series ('lines' in my case), with each their own yaxis, and it seems ECharts doesn't support this.

enter image description here

These metrics do not relate at all, so they all need their own yaxis. I combine them in 1 chart so they can be compared relative to each other (500 visits, €30000, 3% conversion.. etc). It makes no sense to plot 500 visits and 3% conversion rate on the same yaxis.

Is there a way to give each line it's own yaxis? It doesn't have to be a visible one (since there can only be two with ECharts, left/right of canvas, and that's ok), but the data needs to be plotted to an individual axis.

like image 964
Jeffrey Roosendaal Avatar asked Apr 11 '16 15:04

Jeffrey Roosendaal


1 Answers

try this

 yAxis: [
    {
      type: 'value',
      name: 'left_yaxis',
      nameTextStyle: {
        color: '#fff'
      },
      splitLine:{
        show:false,
      },
      axisLabel: {
        textStyle:{
          color:'#fff',
        }
      }
    },
    {
      type: 'value',
      name: 'right_yaxis',
      nameTextStyle: {
        color: '#fff'
      },
      axisLabel: {
        interval:'0',
        textStyle:{
          color:'#fff',
        }
      },
      splitLine: {
        lineStyle: {
          color: ['#454545'],
        }
      },
      min:0,
      //max:800000,
      splitNumber:5
    }
  ],
like image 92
okokqi Avatar answered Oct 21 '22 03:10

okokqi