Highcharts Demo

author(s): Torstein Hønsi

by chodorowicz

HTML

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

<div id="container" style="height: 400px"></div>
<button id="button">Get selected points</button>

JavaScript

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        plotOptions: {
            series: {
                allowPointSelect: true
            }
        },
        series: [{
            data: [{name:'a', y:229.9, color: '#abcabc'}, {name:'a', y:29.9, color: '#ddd'}, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
        }]
    });
    
    
    // the button action
    $('#button').click(function() {
        var selectedPoints = $('#container').highcharts().getSelectedPoints();
        alert ('You selected '+ selectedPoints.length +' points');
    });
});