Reputation: 14370
I am drawing a bar chart like this jsfiddle code
Now the data is given like this
data : [ [ 1, 85], [ 2, 50 ], [ 3, 18], [ 4, 8 ] ]
I need to know how will i be able to access this 85,50,18,8 individually.So that when i take my cursor to the bar chart and click it then it show me the respective values.
It should be something like series.data.
But i don't know how to get the values.
Upvotes: 0
Views: 678
Reputation: 16961
What you need is simply:
// in plotclick handler - to get Y axis value for clicked item
obj.series.data[obj.dataIndex][1]
obj.dataIndex
is index of the point in the data array (which in turn is available as obj.series.data
).
Here's working example http://jsfiddle.net/WnC9B/24/
This answer has been sponsored by http://flot.googlecode.com/svn/trunk/API.txt ;)
Upvotes: 2