Highcharts Demo

author(s): Torstein Hønsi

HTML

<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>

JavaScript

Highcharts.chart('container', {
    chart: {
        zoomType: 'xy'
    },
    title: {
        text: 'Brownsville in The New York Times'
    },
    subtitle: {
        text: 'Crime vs. crime coverage, 2000 through 2016'
    },
    xAxis: [{
        categories: ['2000', '2001', '2002', '2003', '2004','2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
        crosshair: true
    }],
    yAxis: [{ // Primary yAxis
        labels: {
            format: '{value}',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        title: {
            text: ' ',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        }
    }, { // Secondary yAxis
        title: {
            text: ' ',
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        },
        labels: {
            format: '{value} percent',
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        },
        opposite: true
    }],
    tooltip: {
        shared: true
    },
    legend: {
        layout: 'vertical',
        align: 'left',
        x: 150,
        verticalAlign: 'top',
        y: 60,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    },
    series: [{
        name: 'Number of major felony crimes',
        type: 'column',
        
        data: [2714, 2616, 2459, 2280, 2213, 2174, 2149, 2127, 2154, 2011, 2009, 2135, 2249, 2094, 1879, 1735, 1603],
        tooltip: {
            valueSuffix: ''
        }

    }, {
        name: 'Stories that are crime-related',
        type: 'spline',
        yAxis: 1,
        data: [13.04, 18.18, 7.69, 21.05, 22.64, 33.33, 42.59, 37.93, 27.77, 24.24, 15.9, 11.11, 18.75, 21.87, 22.53, 29.68, 39.28],
        tooltip: {
            valueSuffix: ' percent'
        }
    }]
});