Alireza Fattahi Alireza Fattahi - 11 months ago 59
Javascript Question

Jquery Flot get ticks data for tooltip

I am using the jquery flot to show charts with tooltip. I am using ticks to get custom xaxis data. SO

var data = [ [0, 3], [4, 8], [8, 5], [9, 13] ];
var ticksData = [ [0, "A"], [4, "B"], [8, "C"], [9, "D"] ];
xaxis: {
ticks: ticksData,
tickLength: 0

But when I want to show the tooltip, I got the none

$("#placeholder").bind("plothover", function(event, pos, item) {
var x = item.datapoint[0], y = item.datapoint[1];
//x and y are 4,8 instead of B,8

Complete sample

Is there any way to get to fix tool tip to show ticks data, or I should loop through
and re find the value


please check this link, i hope this will helpful for you.


  var x = item.series.xaxis.ticks[item.dataIndex];