Align two Y-Axis with different values in line chart - Javascript highcharts

Javascript examples for highcharts:Chart Value

Description

Align two Y-Axis with different values in line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
    title: {//  w ww. j a v  a2 s . c  o  m
        text: 'Test Chart'
    },
    xAxis: [{
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        crosshair: true
    }],
    yAxis: [{ // Primary yAxis
    type: 'logarithmic',
        labels: {
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        },
        title: {
            text: 'Value 1',
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        },
    }, { // Secondary yAxis
linkedTo:0 ,
    type: 'logarithmic',
        title: {
            text: 'Value 2',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        labels: {
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        opposite: true,
        tickPositions: [0,1,2,3]
    }],
    tooltip: {
        shared: true
    },
    series: [{
        name: 'Value 1',
        type: 'line',
        yAxis: 1,
        data: [2.50, 2.50, 2.50, 3.20, 3.20, 3.20, 3.20, 3.20],
    }, {
        name: 'Value 2',
        type: 'line',
        data: [150, 85.89, 67.43, 38.12, 12.50, 6.20, 2.20, 1.20],
    }]
});

      </script>  
   </body>
</html>

Related Tutorials