2014-08-27 50 views
0

我想按年份呈現2列系列分組。Highcharts:按年份多個系列列

如果兩個系列都具有所有xAxis點(年)的數據,則效果很好。 例如this example繪製了2012年和2013年兩個系列的數據並且效果良好。

但是我發生了什麼事從系列1和2012中刪除了2013系列2,this is the result

我知道,加入null值和缺失年份將解決問題,但可能有另一種解決方案。

+1

您應該使用[pointRange(http://api.highcharts.com/highstock#plotOptions.series.pointRange)參數http://jsfiddle.net/ Lsj8Lngr/1/ – 2014-08-28 13:34:39

+0

查看此演示,其中顯示瞭如何爲每個特定數據點定義時間點:http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/spline-irregular-time/ – 2014-08-28 13:36:29

+0

感謝您的迴應!我喜歡塞巴斯蒂安博尚,解決方案..只是另一個小細節,在你的例子中,2012年已經爲第二個系列預留了空間。如果該系列在同一年沒有數據,是否有刪除空間的方法?謝謝 – 2014-08-28 16:28:50

回答

1

您應該使用pointRange參數http://jsfiddle.net/Lsj8Lngr/1

"column": { 
    pointRange: 365 * 24 * 3600 * 1000, 
    "colorByPoint": true, 
    "grouping": true, 
    "dataLabels": { 
    "enabled": false, 
    "crop": false 
    } 
},