Highcharts Demo

author(s): Torstein Hønsi

by fekkyDev s

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>

CSS

#container {
    height: 400px;
}

JavaScript

var h =[];
Array.prototype.max = function() {
  return Math.max.apply(null, this);
};
Array.prototype.min = function() {
  return Math.min.apply(null, this);
};
var gh = [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        color: 'blue',
        
    }, {
        data: [216.4, 194.1, 95.6, 54.4, 29.9, 1.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5],
        color: 'yellow',
       
    }];
for(var i=0;i<gh.length;i++){
console.log(gh[i].data.max() - gh[i].data.min())
gh[i].maxValue = gh[i].data.max() - gh[i].data.min();
h.push(gh[i]);
}
console.log(h.sort(function(a, b){return b['maxValue'] - a['maxValue']}));

Highcharts.chart('container', {
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    plotOptions: {
        series: {
            lineWidth: 5
        }
    },

    series: h.sort(function(a, b){return b['maxValue'] - a['maxValue']})
});