Does anyone know if/how I can create multiple sets of ticks for the x axis in a flot grid? I'm graphing data over time and I'd like to be able to show specific ticks (days of the month) and then more general ticks (months) under the specific ticks. something like:
1 2 3 4 5 6 7...1 2 3 4 5 6 7 8.....
JUNE JULY
So multiple y-axes are supported as shown here:
http://people.iola.dk/olau/flot/examples/multiple-axes.html
This doc seems to indicate that you can have 2 x-axes: https://github.com/bluesmoon/yui-flot/wiki/API-Documentation---Axes but fails to really explain how it works;
my best guess right now is that you have to have multiple datasets, so you'd have to have a day-by-day series and a month-by-month series, and assign each to a different axis. But I haven't been able to get it to work.
Instead of my single x-axis:
xaxis: { show: false, tickFormatter: nanometers },
I'm using this line:
xaxes: [{ tickFormatter: nanometers }, { tickFormatter: function(n) { return n+"cm^-1" } }],
No luck so far, tell me if you get anywhere!
UPDATE
OK, got it - you have to assign the second dataset to the second axis like this:
data = [{label: "Title",data:[1,2,3,4,5]},{data:[2,4],xaxis:2}]
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