JQPlot 没有使用正确的日期

JQPlot not using the correct dates

我正在使用 jqplot 绘制图形,但绘制的日期错误。请参阅下面的代码段和图片。

else if(rtype === "DATE AXES"){
    $scope.pl = [[]];
    for (var i = 0; i < plotVal.length; i++) {
        console.log(plotVal[i].x+", "+plotVal[i].y);
        $scope.pl.push([new Date(plotVal[i].x), plotVal[i].y]);
    }
    var data = $scope.pl;
    console.log("data: ");
    console.log(data)
    jQuery.jqplot("chartdiv",  [data],
        { 
            axes:{
                xaxis:{
                    renderer:$.jqplot.DateAxisRenderer,
                }
            },
            series:[{color:'#5FAB78', markerOptions:{style:'square'}}],
        });
} 

知道哪里出了问题吗?

找到问题了。就是代码中的pl数组;首先向其中传递了一个空值,因此它扭曲了排列

$scope.pl = [[]];

应该是:

$scope.pl = [];