我想將JSON文件加載到highcharts中。但是,我無法理解如何去做。 y軸標籤的年份值從2046將JSON文件加載到highcharts中繪製折線圖
開始JSON文件如下:
{
"year":[2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068],
"bus":[4159,458,413,606,1168,850,486,608,899,872,494,1203,868,432,732,753,1528,1564,1419,1843,1888,1610,1016],
"mini_bus":[2064,226,148,185,77,83,82,175,130,19,122,250,475,298,237,285,663,806,1179,593,780,1370,602],
"crane":[8969,800,1524,1491,1740,1629,1151,907,1291,978,829,1271,1798,1212,1477,1592,2263,3278,3594,3643,4524,1969,593],
"car":[24050,1893,2115,2266,3049,3043,5261,2993,4139,2507,3647,5152,4374,2906,7079,4781,5114,5156,4741,6857,12268,8510,5403],
"pick_up":[0,0,0,0,0,0,0,0,0,0,0,0,0,581,478,0,36,736,1588,1287,1975,3087,1208],
"micro":[0,0,0,0,0,0,0,0,0,0,0,0,0,232,884,584,66,138,31,128,145,115,61],
"tempo":[2359,856,1207,62,154,241,117,185,344,388,789,232,248,17,16,48,60,12,18,20,9,2,6],
"motorcycle":[35776,4954,8154,7608,8653,9401,13855,12633,12306,17090,19755,29291,38522,29404,26547,31093,45410,72568,69666,83334,168707,138907,90305],
"tractor":[6769,788,548,262,1396,1814,2183,1257,1265,2248,2542,3519,3189,2485,2191,1374,635,2942,3297,4663,11460,7937,2512],
"others":[102,1549,358,381,372,353,58,352,51,37,102,77,86,43,58,21,0,1535,206,202,31,133,73],
"total":[84248,11524,14467,12861,16609,17414,23193,19110,20425,24139,28280,40995,49560,37610,39699,40531,55775,88735,85739,102570,201787,163640,101779],
"cumulative_total":[84248,95772,110239,123100,139709,157123,180316,199426,219851,243990,272270,313265,362825,400435,440134,480665,536440,625175,710914,813484,1015271,1178911,1280690]
}
請幫助!
看看演示,他們是在做什麼很清楚:HTTP://的jsfiddle。 net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ – ktm5124
我已經看過演示了。我需要加載一個JSON文件,而不是使用$ .getJSON方法,然後用highcharts顯示它。 –
爲什麼你不能使用getJSON? –