Search code examples
javascriptchartsflotgraphing

How do I change the stepping of y-axis values in Flot?


I have a graph of memory use over time which looks like: alt text

I set the y-axis: { max:n } value n to 1024 (which means 1024MB of RAM).

How do I get Flot to change the y-axis labels so they display:

1024
 768
 512
 256
 128
   0     

Solution

  • You can use the ticks option for this:

    yaxis: { max: 1024, ticks: [128, 256, 512, 768, 1024] }
    

    You can test it out here, the markings option is just to give it a bit of style, if you're after an effect like that at all.