Flot charts, xaxis minimum length

前端 未结 3 640
傲寒
傲寒 2021-01-26 10:25

The xaxis in my flot line charts can take an array of data up to but no more than 16 in length. The problem is when my data is less than 16, the x axis is spreading out to show

相关标签:
3条回答
  • 2021-01-26 10:34

    I've cracked it byadding another data set which is 16 in length but has lines:{show:false} set :) job done!

    0 讨论(0)
  • 2021-01-26 10:41

    You can use minTickSize according to the documentation of flot.

    minTickSize : [1, "day"],
    
    0 讨论(0)
  • 2021-01-26 10:44

    One possibility is to provide a number for the ticks option:

    ticks: 16
    

    However that is treated only as a guideline; Flot always tries to make the ticks fit, and will reduce the number when it detects that they would overlap or run off the side of the plot. If you really want to force it to use 16 (which I wouldn't recommend, since the labels will probably overlap) you'll need to manually provide an array of ticks:

    ticks: [0, 5, 10, ...]
    
    0 讨论(0)
提交回复
热议问题