0
我試圖繪製圖表和圖表,如果手動輸入數字,一切都很好。如將變量添加到Jqplot
chart = $.jqplot('chartContainer',
[[[0, firstActual],[.5, trajectory]],
[[0, firstGoal],[1, secondGoal],[2, thirdGoal],[3, fourthGoal],[4, fifthGoal]],
[[.5, trajectory]]], {
這些變量事先定義好,工作正常。現在,如果我想這樣做
var test = "["+0+"," +firstActual+"], ["+.5+", "+trajectory+"]";
chart = $.jqplot('chartContainer',
[[test],
[[0, firstGoal],[1, secondGoal],[2, thirdGoal],[3, fourthGoal],[4, fifthGoal]],
[[.5, trajectory]]], {
第一行不會打印。我猜這與測試是一個字符串有關嗎?無論如何要讓測試出現在jqplot函數內?