2013-04-08 45 views
1

我使用高圖來繪製一些圖表。我用的是基本的線圖是這樣的:圖例底部爲高圖

http://www.highcharts.com/demo/spline-irregular-time

我怎樣才能圖表區域下,而不是在正確的顯示圖例?

http://www.highcharts.com/demo/column-stacked-percent

THX

+0

API highcharts - > [圖例對齊](http://api.highcharts.com/highcharts#legend.align) – 2013-04-08 13:29:26

+0

你不能把它的圖表下,我意思是,我沒有做到這一點 – Sebastien 2013-04-08 13:30:59

+0

對不起,你需要[verticalAlign](http://api.highcharts.com/highcharts#legend.verticalAlign)爲'底部'。 – 2013-04-08 13:31:58

回答

4

marginBottom可用於將圖例置於圖表底部。您仍然可以使用圖例屬性來移動圖例,例如在中間或右側(我使用中間)。

chart: { 
     marginBottom: 100 
    }, 

    legend: { 
     align: 'center', 
     verticalAlign: 'bottom', 
     x: 0, 
     y: 0 
    }, 

可能的解決方案:fiddle

2

具有圖下的傳說是默認的,所以你完全可以省略legend屬性格式。請記住,爲了使這看起來不錯,您必須添加一點到底部邊距,否則圖表和圖例將重疊。

chart: { 
    type: 'line', 
    marginRight: 130, 
    marginBottom: 70 // Increase this to 70 or so 
}, 
// Remove the legend property completely 

Here's a demonstration