Does anyone know how to get flot to display a type of 'timeline'?
E.g.
Y:
Person1| ----- -------
Person2| ------- -------
Person3| -- ----- ----
Person4| -------
_____________________
X: Jan Feb March April
I'm not sure how to display the labels on the y axis and show the data linear
Solution so far :)
$(document).ready(function(){
var d1 = [[(new Date("01/01/2009")).getTime(), 5], [(new Date("10/01/2009")).getTime(), 5]];
var placeholder = $("#placeholder");
// plot it
var plot = $.plot(placeholder, [d1], {xaxis:{mode:"time", timeformat:"%b.%y"}});
});
Thanks in advance!
Finally found the answer. Use the configuration 'ticks'.
Solution:
//american dates
var d1 = [[(new Date("01/01/2009")).getTime(), 1], [(new Date("01/10/2009")).getTime(), 1]];
var d2 = [[(new Date("05/05/2009")).getTime(), 2], [(new Date("06/23/2009")).getTime(), 2]];
var d3 = [[(new Date("03/10/2009")).getTime(), 3], [(new Date("03/15/2009")).getTime(), 3]];
//var d1 = [[0, 5], [5, 5], null, [5, 10], [15, 10]];
var placeholder = $("#placeholder");
// plot it
var plot = $.plot(placeholder, [d1,d2,d3], {
xaxis:{mode:"time", timeformat:"%b.%y"},
yaxis:{ticks:[[1, "Apple"], [2, "Microsoft"], [3, "Dell"]]}
});
View the source of http://people.iola.dk/olau/flot/examples/basic.html
pay particular attention to the comment // a null signifies separate line segments
I think that should get you where you want to be.