Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery-Flot: How to add text label for Y-axis and date label for X-axis?

Tags:

jquery

flot

So basically, I have a test graph in JQuery-Flot, and instead of the normal integer axis. I need to use text label for the Y-axis and date label for the X-axis. Do anyone know how to do this?

like image 257
Bill Software Engineer Avatar asked Nov 28 '11 19:11

Bill Software Engineer


1 Answers

The flot api covers both of these cases (under "Customizing the axes"). For the x-axis you'll want to use the "time" option. For the y-axis tick labels you'll want to specify the ticks option (what text should appear at each location):

ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]] 
like image 77
Mark Avatar answered Nov 17 '22 20:11

Mark