如何在Highcharts中使用循环类别

时间:2016-02-02 07:20:07

标签: javascript highcharts

大家好,我有几组值我希望使用Highcharts.js在一张图中显示所有这些值现在我已经硬编码了值,如果我想推送值怎么做

enter code here
data set -1 
        "data_set": [{"y": 4.188145161290322, "x": "2016-01-13 04:54:01.594091"}, {"y": 4.292354838709678, "x": "2016-01-13 06:09:25.834223"}]

 data-set-2 

enter code here
 "data_set": [{"y": 25145.715, "x": "2016-01-13 04:55:30.057155"}, {"y": 25478.8025, "x": "2016-01-13 06:11:03.849181"}]

这就是我所做的

http://jsfiddle.net/Goutham_Pratapa/4xtsjbn6/2/ 提前谢谢

1 个答案:

答案 0 :(得分:1)

您替换这些行

    "data_set": [{"y": 4.188145161290322, "x": "2016-01-13 04:54:01.594091"}, {"y": 4.292354838709678, "x": "2016-01-13 06:09:25.834223"}]

使用字符串变量

    "data_set": [{"y": stringY1, "x": stringX1}, {"y": stringY2, "x": stringX2}]

只需在程序中的其他位置初始化变量