customization - highcharts customize tooltip for a single point -


i want customize tooltip of last point in specific series, leave other points in series, , other series, default tooltip format. basically, looking similar config. in advance help!

series: [{             tooltip: {    // ?? tooltip not work inside series                 formatter: function() {                     if (lastpoint in series) {  // ?? how determine if lastpoint                         return '<b>final result </b> ' + this.y;                     }                     // ?? return default format if not last point in series                 }             },                         data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6]                 }, {             data: [194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2]                 }] 

the formatter function doesn't seem work when it's defined series. can check series in using this.series.name , can check if on final point using this.series.xdata.length - 1 == this.point.x. but, easier name point want target , check in formatter function. http://jsfiddle.net/swsbb/. see formatter data, check here http://api.highcharts.com/highcharts#tooltip.formatter.

$('#container').highcharts({        xaxis: {         categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul']     },     tooltip : {         formatter: function() {             var tooltip;             if (this.key == 'last') {                 tooltip = '<b>final result </b> ' + this.y;             }             else {                 tooltip =  '<span style="color:' + this.series.color + '">' + this.series.name + '</span>: <b>' + this.y + '</b><br/>';             }             return tooltip;         }     },        series: [{                 data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, {y:135.6, name: 'last'}]      },     {         data: [194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2]     }]  });  

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -