简体   繁体   English

Flot Chart工具提示显示x轴的最后日期值,而不是当前值

[英]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. y轴和x轴的值很好,但是当我将鼠标悬停在该点时,它显示了X的最后一个值,Y的值也很好。 X has date values. X具有日期值。 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 . 例如,如果我将鼠标悬停在Mar/2014 ,工具提示会显示Feb/2014 ,或者如果我将鼠标悬停在05/May/2014 ,则工具提示会显示04/May/2014 Values on the X-axis and Y-axis are fine, only the tooltip seems to be the problem. X轴和Y轴上的值都很好,似乎只有工具提示才是问题。

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? 有什么方法可以操纵%x来增加一个值或其他值?

Question solved. 问题解决了。 I added the date format at the tooltip too, just like in xaxis. 我也在工具提示中添加了日期格式,就像在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" . 在timeFormat中,您放置了一个类似var timeFormat = "%d/%b/%Y"的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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