Highcharts Demo

author(s): Torstein Hønsi

by J. Albert Bowden

HTML

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

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

CSS

.highcharts-tooltip h3 {
    margin: 0.3em 0;
}

JavaScript

Highcharts.chart('container', {

    chart: {
        type: 'bubble',
        plotBorderWidth: 1,
        zoomType: 'xy'
    },

    legend: {
        enabled: false
    },

    title: {
        text: 'Scatterplot Title Text (YEAR)'
    },

    subtitle: {
        text: 'Source: <a href="">link text</a>'
    },

    xAxis: {
        gridLineWidth: 1,
        title: {
            text: 'Government Restrictions Index (GRI)'
        },
        labels: {
            format: '{value} Low-High'
        },
        /** plotLines: [{
            color: 'black',
            dashStyle: 'dot',
            width: 2,
            value: 65,
            label: {
                rotation: 0,
                y: 15,
                style: {
                    fontStyle: 'italic'
                }//,
                //text: 'Safe fat intake 65g/day'
            },
            zIndex: 3
        }] **/
    },

    yAxis: {
        startOnTick: false,
        endOnTick: false,
        title: {
            text: 'Social Hostilities Index (SHI)'
        },
        labels: {
            format: '{value} low-high'
        },
        maxPadding: 0.2,
        /** plotLines: [{
            color: 'black',
            dashStyle: 'dot',
            width: 2,
            value: 50,
            label: {
                align: 'right',
                style: {
                    fontStyle: 'italic'
                }//,
                //text: 'Safe sugar intake 50g/day',
                //x: -10
            },
            zIndex: 3
        }] **/
    },

    tooltip: {
        useHTML: true,
        headerFormat: '<table>',
        pointFormat: '<tr><th>GRI:</th><td>{point.x}g</td></tr>' +
            '<tr><th>SHI:</th><td>{point.y}g</td></tr>' +
            '<tr><th>POP.:</th><td>{point.z}%</td></tr>',
        footerFormat: '</table>',
        followPointer: true
    },

    plotOptions: {
        series: {
            dataLabels: {
                enabled: true,
                format:...