Olsi
Olsi

Reputation: 89

Flot Chart Tooltip showing last date value of x-axis, not the current value

The values of y-axis and x-axis are fine, but when I hover at the point, it shows the last value of X, the value of Y is fine. X has date values. E.g. if I hover at Mar/2014, the tooltip says Feb/2014, or if i hover at 05/May/2014, the tooltip says 04/May/2014. Values on the X-axis and Y-axis are fine, only the tooltip seems to be the problem.

tooltipOpts: {
    content: function() {
        return "%s: %x | %y"
    },
    shifts: {
        x: -30,
        y: -50
    }
}

Is there any way I can manipulate %x, to increase one value or something?

Upvotes: 1

Views: 977

Answers (1)

Olsi
Olsi

Reputation: 89

Question solved. I added the date format at the tooltip too, just like in xaxis.

tooltipOpts: {
    content: function(){
       return " %x | %y"
    },
    xDateFormat: timeFormat,
    shifts: {
       x: -30,
       y: -50
    }
 }

In timeFormat you put a string like var timeFormat = "%d/%b/%Y".

Upvotes: 2

Related Questions