Highcharts Demo

author(s): Torstein Hønsi

HTML

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

<div id="container" style="height: 400px"></div>

JavaScript

$(function () {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            defaultSeriesType: 'column'
        },
        xAxis: {
            categories: ['Total'],
            labels: {
                enabled: false
            }
        },
        plotOptions: {
            series: {
                allowPointSelect: true,
                stacking: 'normal',
                point: {
                    events: {
                        select: function(){
                            if (this.series.options.id == 'positive') {
                                this.series.setData([{
                                    y: this.y,
                                    color: 'green'
                                }]);
                            } else if (this.series.options.id == 'negative') {
                                this.series.setData([{
                                    y: this.y,
                                    color: 'red'
                                }]);
                            }
                        }
                    }
                }
            }
        },
        series: [{
            id: 'positive',
            name: 'Positive',
            data: [29.9],
            color: 'blue',
            stack: 'total'           
        }, {
            id: 'negative',
            name: 'Negative',
            data: [-130.4],
            color: 'blue',
            stack: 'total'           
        }]
    });
    
    
    
});