使用关联数组填充图表

时间:2013-02-18 11:55:13

标签: jquery jqplot

我正在尝试使用包含以下数据的数组(dateVal)填充jqplot图表:

console.log( index + " : " + dateVal[index]);

OUTPUT BELOW

February 01, 2013 : 12
February 02, 2013 : 12
February 03, 2013 : 12
February 04, 2013 : 43
February 05, 2013 : 45

我正在尝试使用此代码,但它会引发一个未被捕获的错误:

var plot = $.jqplot('chart1', [dateVal], {

    title:'Rubric Average Scores',
    gridPadding:{right:35},
    axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer,
        tickOptions:{formatString:'%Y-%m-%d'},
        //tickOptions:{formatString:'%b-%y'},
        tickInterval:'1 month',
        angle: -30,
    }},
    yaxis:{label:'Average Score',},
    series:[{lineWidth:3, markerOptions:{style:'square'}}]
});

1 个答案:

答案 0 :(得分:0)

我必须让dateVal成为一个数组数组......