Getting multiple linear underlays on a scatter plot chart - Javascript highcharts

Javascript examples for highcharts:Scatter Chart

Description

Getting multiple linear underlays on a scatter plot chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
var Y_MAX = 6;//from   ww  w . j  a v a 2  s . c o  m
var X_MAX = 5;
$(function () {
    $('#container').highcharts({
        title: {
            text: 'Scatter plot with stacked area ratio chart'
        },
        plotOptions: {
            area: {
                stacking: 'normal'
            }
        },
        xAxis: {
            min: 0,
            max: X_MAX
        },
        yAxis: {
            min: 0,
            max: Y_MAX
        },
        series: [{
            type: 'area',
            name: 'Ratio',
            data: [{x: 0, y: 0}, {x: X_MAX, y: 0.4*Y_MAX}]
        }, {
            type: 'area',
            name: 'Ratio',
            data: [{x: 0, y: 0}, {x: X_MAX, y: 0.6*Y_MAX}]
        }, {
            type: 'scatter',
            name: 'Observations',
            data: [1, 0.5, 3.8, 5.5, 3.9, 2.2],
            marker: {
                radius: 8
            }
        }]
    });
});

      </script> 
   </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>  
   </body>
</html>

Related Tutorials