javascript - Custom tooltip data for specific points on highchart -
i display warning, or explanation, in tooltip, when hover on specific 1 or 2 points. these warnings unique point can't repeated.
i've put custom text 'warning' , 'warning 2' within series data, can't seem call data once per tooltip contains it.
my series data looks this:
series: [{ color: '#333', name: 'pre-tax profits', data: [{y: 811, custom: 'warning'}, 881, 465, -137, 491, 567, 284, 35, 675] }, { color: '#00adef', name: 'revenues', data: [2663, 2300, 1851, 1782, { y: 2103, custom: 'warning 2'}, 2154, 1665, 1666, 2149] }] the 'y' seems superfluous error without it.
here how i've called far in tooltip formatter...
formatter: function () { var s = '<b>' + this.x + '</b>'; $.each(this.points, function () { s += '<br/>' + this.series.name + ': ' + this.y + 'm'; s += '<h2>' + this.point.custom + '</h2>'; }); return s; }, because i'm calling within each point i'm getting undefined on of them when want call once if has warning, per tooltip. maybe make whole new serie these warnings in shows in tooltip?
heres demo see i'm talking about...
http://thetally.efinancialnews.com/tallyassets/barclays-ib/index.html
you need check existence of custom property in s builder. if propery exists append tooltip string, if not, nothing (or else).
Comments
Post a Comment