Javascript Jquery flot图未打印

Javascript Jquery flot图未打印,javascript,jquery,charts,flot,Javascript,Jquery,Charts,Flot,我有以下JS数据: var store = []; store.push([new Date('2012-01-01'), 2]); store.push([new Date('2012-01-02'), 3]); store.push([new Date('2012-01-03'), 4]); store.push([new Date('2012-01-04'), 6]); store.push([new Date('2012-01-05'), 3]); store.push([new Dat

我有以下JS数据:

var store = [];
store.push([new Date('2012-01-01'), 2]);
store.push([new Date('2012-01-02'), 3]);
store.push([new Date('2012-01-03'), 4]);
store.push([new Date('2012-01-04'), 6]);
store.push([new Date('2012-01-05'), 3]);
store.push([new Date('2012-01-06'), 4]);
store.push([new Date('2012-01-07'), 2]);
store.push([new Date('2012-01-08'), 1]);
store.push([new Date('2012-01-09'), 4]);
store.push([new Date('2012-01-10'), 2]);
store.push([new Date('2012-01-11'), 3]);
store.push([new Date('2012-01-12'), 6]);
store.push([new Date('2012-01-13'), 2]);
store.push([new Date('2012-01-14'), 5]);
store.push([new Date('2012-01-15'), 4]);
store.push([new Date('2012-01-16'), 2]);
store.push([new Date('2012-01-17'), 6]);
store.push([new Date('2012-01-18'), 6]);
store.push([new Date('2012-01-19'), 1]);
store.push([new Date('2012-01-20'), 1]);
store.push([new Date('2012-01-21'), 1]);
store.push([new Date('2012-01-22'), 8]);
store.push([new Date('2012-01-23'), 8]);
store.push([new Date('2012-01-24'), 13]);
store.push([new Date('2012-01-25'), 5]);
store.push([new Date('2012-01-26'), 5]);
store.push([new Date('2012-01-27'), 1]);
store.push([new Date('2012-01-28'), 1]);
store.push([new Date('2012-01-29'), 2]);
store.push([new Date('2012-01-30'), 6]);
Flot代码:

$.plot($('.chart'), store);
HTML:


我在x和y轴上的轴仅显示从-1到1。。我根本看不到图表在绘图。我哪里做错了

提前感谢,

试试这个:

<html>
<head>
   <script language="javascript" type="text/javascript" src="jquery.js"></script>
   <script language="javascript" type="text/javascript" src="jquery.flot.js"></script>
</head>
<body>
    <div class="chart"></div>
    <script type="text/javascript">
        $(function () {
            var store = [];
            store.push([new Date(2012, 1, 1)).getTime(), 2]);
            .
            .
            .
            store.push([(new Date(2012, 1, 30)).getTime(), 6]);

            $.plot($('.chart'), store, {
                grid: {hoverable: true},
                xaxis: {
                    mode: "time",
                    timeformat: "%d.%m.%y",
                        minTickSize: [1,"day"],
                    min: (new Date(2012, 1, 1)).getTime(),
                    max: (new Date(2012, 1, 30)).getTime()
                },
                yaxis: {
                    mode: "number",
                    tickSize: 1
                },
                series: {
                    lines: { show: true },
                    points: { show: true }
                }
            });
        });
    </script>
</body>
</html>

$(函数(){
var存储=[];
store.push([newdate(2012,1,1)).getTime(),2]);
.
.
.
store.push([(新日期(2012年1月30日)).getTime(),6]);
$.plot($('.chart'),存储{
网格:{hoverable:true},
xaxis:{
模式:“时间”,
时间格式:“%d.%m.%y”,
minTickSize:[1,“天”],
min:(新日期(2012年1月1日)).getTime(),
max:(新日期(2012年1月30日)).getTime()
},
亚克斯:{
模式:“数字”,
尺寸:1
},
系列:{
行:{show:true},
要点:{show:true}
}
});
});
试试这个:

<html>
<head>
   <script language="javascript" type="text/javascript" src="jquery.js"></script>
   <script language="javascript" type="text/javascript" src="jquery.flot.js"></script>
</head>
<body>
    <div class="chart"></div>
    <script type="text/javascript">
        $(function () {
            var store = [];
            store.push([new Date(2012, 1, 1)).getTime(), 2]);
            .
            .
            .
            store.push([(new Date(2012, 1, 30)).getTime(), 6]);

            $.plot($('.chart'), store, {
                grid: {hoverable: true},
                xaxis: {
                    mode: "time",
                    timeformat: "%d.%m.%y",
                        minTickSize: [1,"day"],
                    min: (new Date(2012, 1, 1)).getTime(),
                    max: (new Date(2012, 1, 30)).getTime()
                },
                yaxis: {
                    mode: "number",
                    tickSize: 1
                },
                series: {
                    lines: { show: true },
                    points: { show: true }
                }
            });
        });
    </script>
</body>
</html>

$(函数(){
var存储=[];
store.push([newdate(2012,1,1)).getTime(),2]);
.
.
.
store.push([(新日期(2012年1月30日)).getTime(),6]);
$.plot($('.chart'),存储{
网格:{hoverable:true},
xaxis:{
模式:“时间”,
时间格式:“%d.%m.%y”,
minTickSize:[1,“天”],
min:(新日期(2012年1月1日)).getTime(),
max:(新日期(2012年1月30日)).getTime()
},
亚克斯:{
模式:“数字”,
尺寸:1
},
系列:{
行:{show:true},
要点:{show:true}
}
});
});

我遇到了这个问题,我认为您需要将数组包装到另一个数组中

$.plot($('.chart'), [store]);

我遇到了这个问题,我认为您需要将您的数组包装到另一个数组中

$.plot($('.chart'), [store]);

您需要将x轴模式设置为“时间”,并以毫秒为单位提供时间戳。有关更多信息,请参见“时间序列数据”标题下的。

您需要将x轴模式设置为“时间”,并以毫秒为单位提供时间戳。有关更多信息,请参阅“时间序列数据”标题下的