简体   繁体   中英

keep right position label x-axis jquery flot

I'm finding about jquery flot .

So, i had a problem, that i want to hard fix grid value on x-axis .

For examples:

It will update realtime.

[4:02, 5:02, 6:02, 7:02, 8:02, 9:02] after 1 hour, it only change label value and keep right position.

4:02 become 5:02 and keep right position, 5:02 become 6:02 and keep right position,...

在此处输入图片说明

Hope every body can support me, thank you very much.

Here is my demo: my demo

Instead of only adding new ticks after each hour you have to generate the complete tick array after every update with something like this (updated fiddle ):

var first_hour = data_speed_hour[0][0];
options_hour.xaxis.ticks = [
    first_hour,
    first_hour + 3600000*1,
    first_hour + 3600000*2,
    first_hour + 3600000*3,
    first_hour + 3600000*4,
    first_hour + 3600000*5,
    first_hour + 3600000*6 //- 600000
  ];

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