简体   繁体   中英

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. Eg 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?

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" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM