Highcharts - advanced tooltip functionality needed

http://stackoverflow.com/questions/7209379/highcharts-advanced-tooltip-functionality-needed

by jgdreyes

HTML

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

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

JavaScript

$(function() {

    var seriesTotal = [
        {x: 0, y: 0, customTooltip: 0, customOther: "1 Value!"},
        {x: 1, y: 0, customTooltip: 0, customOther: "2 Value!"},
        {x: 2, y: 0, customTooltip: 0, customOther: "3 Value!"},
        {x: 3, y: 1, customTooltip: 1, customOther: "4 Value!"},
        {x: 4, y: 1, customTooltip: 1, customOther: "5 Value!"},
        {x: 5, y: 1, customTooltip: 2, customOther: "6 Value!"},
        {x: 6, y: 1, customTooltip: 3, customOther: "7 Value!"}
    ];
    var seriesInService = [
        {x: 0, y: 0, customTooltip: 0, customOther: "A Value!"},
        {x: 1, y: 0, customTooltip: 0, customOther: "B Value!"},
        {x: 2, y: 0, customTooltip: 0, customOther: "C Value!"},
        {x: 3, y: 0, customTooltip: 0, customOther: "D Value!"},
        {x: 4, y: 0, customTooltip: 0, customOther: "E Value!"},
        {x: 5, y: 1, customTooltip: 1, customOther: "F Value!"},
        {x: 6, y: 2, customTooltip: 2, customOther: "G Value!"}
    ];
    
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },

        plotOptions: {
            series: {
                stacking: 'normal'
            }
        },
        
        tooltip: {
            formatter: function() {
                var txt = "Original Value: " + this.y;
                txt += "<br />New Value: " + this.point.customTooltip;
                txt += "<br />Other Custom Value: " + this.point.customOther;
                return txt;
            }
        },

        series: [
            {data: seriesTotal}, 
            {data: seriesInService}
        ]
    });
});