Highcharts Demo

author(s): Torstein Hønsi

by ahonaker

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>

<div id="container" style="min-width: 310px; height: 600px; margin: 0 auto"></div>

JavaScript

var chart = Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    title: {
        text: 'Monthly Average Rainfall'
    },
    subtitle: {
        text: 'Source: WorldClimate.com'
    },
    xAxis: {
        categories: [
            'Jan',
            'Feb',
            'Mar',
            'Apr',
            'May',
            'Jun',
            'Jul',
            'Aug',
            'Sep',
            'Oct',
            'Nov',
            'Dec'
        ],
        min: 0,
        max: 11,
        crosshair: true
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Rainfall (mm)'
        }
    },
    tooltip: {
        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
            '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0
        }
    },
    series: [{
    		type: 'line',
        name: 'Target',
    		step : true,
        marker: {
        	enabled: false
        },
        label: {
        	enabled: true
        },
        showInLegend: false,
        data: [
        	[-0.5,200],[5,225],
          [5,225],[11.5,225]
        ],
        zoneAxis: 'x',
        zones: [
        	{
          	value: 0,
        		color: 'blue'
          },{
          	value: 5.5,
        		color: 'blue'
          },{
          	value: 5.5,
          	color: 'red'
          },{
            value: 11,
            color: 'red'
          }
        ]
    },{
        type: 'polygon',
        name: 'Warning',
        label: {
        	enabled: true
        },
        color: '#FFFF66',
        zIndex: -100,
        showInLegend: false,
        data: [
            [-0.5, 50],
            [4.5, 50],
            [4.5, 100],
            [-0.5, 100]
...