在Flot中显示时间线/线性数据 [英] Display Timeline/Linear data in Flot
本文介绍了在Flot中显示时间线/线性数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如
<$ p
有人知道如何让flot显示'timeline'类型吗? $ p> Y:
Person1 | ----- -------
Person2 | ------- -------
Person3 | - ----- ----
Person4 | -------
_____________________
X:一月二月三月四月
我不确定如何在y轴上显示标签并显示数据线性
解决方案到目前为止:)
$ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ [[(new Date(01/01/2009))。getTime(),5],[(new Date(10/01/2009))。getTime(),5]];
var placeholder = $(#placeholder);
//绘制它
var plot = $ .plot(占位符,[d1],{xaxis:{mode: time,timeformat:%b。%y}});
});
预先感谢!
解决方案
终于找到答案。
解决方案:
//美国日期
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);
//绘制
var plot = $ .plot(占位符,[d1,d2,d3],{
xaxis:{mode:time,timeformat: %b%y},
yaxis:{ticks:[[1,Apple],[2,Microsoft],[3,Dell]]}
});
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"]]}
});
这篇关于在Flot中显示时间线/线性数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文