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 Post'
    },
    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: [7.14, 0, 0, 0, 50, 52.17, 61.11, 50, 28.57, 42.85, 36.36, 20, 16.62, 30.26, 43.75, 46.8, 40],
        tooltip: {
            valueSuffix: ' percent'
        }
    }]
});