How do I get non-numeric values on a Flot graph axis?
For example, on the Y-axis I would like to have (excuse the crappy graph):
/*
A|
B| _/*----------*
C| _/ \
D| _/ \
E| _/ \
F| / \
G| * *
--------------------------------
100 200 300 400
The data I would provide will look like this: var data = [[100, 'G'], [200, 'B'], [300, 'B'], [400, 'G']];
You can also associate text with a tick value, like this:
ticks: [[0, "G"], [1, "F"], [2, "E"], [3, "D"]], // so on
The nice thing about doing it this way is you can control it completely at runtime from your AJAX call (assuming you pass down the axis configuration using JSON), whereas the currently posted solution requires a hard-coded function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With