How do I change the stepping of y-axis values in Flot?
-
10-10-2019 - |
Question
I have a graph of memory use over time which looks like:
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow