Jim Connett
Jim Connett

Reputation: 1

Stop HighCharts tooltip y-value conversion on 'area range with line' chart

I have a dataset I'm trying to graph using HighCharts and the "area range with line" chart; every value in the dataset is uniformly reported in scientific E notation (ex. 1.342E8). When using a standard line graph or bar graph in HighCharts, scientific E notation plots correctly, the axis labels are correct, and the tooltip reports the y-value in scientific E notation. When applying the "area range with line" chart to this same dataset, the points plot correctly (both line and range values), axis labels are good, but the tooltip shows the y: value as 0.000000 instead of 1.342E8).

Thinking I could force a format, I tried to create a very basic "this.x, this.y" formatter function in the tooltip section of the "area range with line" chart, but when I do so, the tooltip completely stops working on this chart type.

As another test, I took this chart example from http://jsfiddle.net/77mZz/ (the same chart type I'm using) and changed the first value in the "averages" array to 1.2154E-9 as shown below:

averages = [ [1246406400000, 1.2154E-9], [1246492800000, 22.1], [1246579200000, 23], [1246665600000, 23.8], [1246752000000, 21.4], [1246838400000, 21.3], (...)

...then reran the output. Yes, it's non-sensical output, but it does show the non-scientific E format in the tooltip when hovering over the modified point.

It appears to me the tooltip for this chart type is converting the E notation to a float. I do not want this conversion to occur. When a user hovers over a point on this chart type, the tooltip should display the value in scientific E notation. How can I force the tooltip output to report this.y in scientific E notation?

Upvotes: 0

Views: 1276

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can use formatter() and return y value.

http://jsfiddle.net/77mZz/1/

 formatter:function(){
            return this.y + '°C';
            }

Upvotes: 0

Related Questions