Adam
Adam

Reputation: 2031

How to set the x value for High Charts error bar

Is it possible to specify both x and y (min, max) co-ordinates for an error bar (confidence interval) in HighCharts? I'm able to use this format for normal series, but not when type: 'errorBar' is set.

i.e., instead of this:

data: [
    [0.06, 0.175], 
    [], [], [], 
    [0.49, 0.65], 
    [], [], [], [], [], 
    [0.395, 0.57], 
    [], [], [], [], [], [], [], 
    [0.17, 0.34], 
    [], [], [], [], [],
    [0.07, 0.17]
]

I want to be able to do this:

data: [
     {x:0, y:[0.05, 0.2]}, 
     {x:4, y:[0.48, 0.68]}, 
     {x:10, y:[0.38, 0.58]}, 
     {x:18, y:[0.16, 0.36]}, 
     {x:24, y:[0.03, 0.23]}
]

Upvotes: 3

Views: 1429

Answers (1)

jlbriggs
jlbriggs

Reputation: 17791

You can do it, just not like that :) The parameters for the data point object are x, low, high.

You can specify that two ways, either as an object:

{x:0, low:0.05, high:0.2} 

or as a simple array:

[0, 0.05, 0.2]

example:

http://jsfiddle.net/JVNjs/290/

Upvotes: 8

Related Questions