下面的代码没有使用Flot绘制图表-它只是变成了一个空图表,x轴在00:00,y轴在-1到1之间:
<div id='chart' style='height:200px; width: 300px'></div>
<script>
drawChart();
function drawChart() {
var d1 = [[1360652400000, 22.5],[1360662400000, 24.4]];
$.plot($('#chart'), d1, {xaxis: {mode: 'time'}});
}
</script> 发布于 2013-02-13 07:18:34
您缺少一组数组括号来表示它是数据系列1这一事实。
改用下面的代码:
function drawChart() {
var d1 = [[1360652400000, 22.5],[1360662400000, 24.4]];
$.plot($('#chart'), [d1], {xaxis: {mode: 'time'}});
}它应该工作得很好。
JSFiddle Here
忽略JavaScript示例顶部的代码,它只是jquery.flot.time.js,我找不到它的CDN (但需要使用模式:'time')
https://stackoverflow.com/questions/14843367
复制相似问题