2013-06-04 17 views
0
chart: { 
     height:"300", 
     width:"600",    
     type: 'column', 
     viewBox:"0 0 1000 400" 
    } 

viewbox在高圖表中沒有工作。高圖中的視圖框

請給我一個解決方案。

+0

Viewbox在Highcharts不可用。所有參數可在這裏http://api.highcharts.com/highcharts#chart –

+0

@jem:你應該接受有用的答案。它有助於建立你的回購以及SO。 –

回答

0

有沒有這樣的事情viewBox與Highcharts。

參見:API Documentation

創建一個圍繞圖表邊框你可以使用:

chart: { 
     height:"300", 
     width:"600",    
     type: 'column', 
     borderWidth:1, // around chart 
     plotBorderWidth:1, // around plot 
    } 
2

將圖表添加到DOM。它是可以在其上設置屬性,像這樣的SVG節點元素:

setTimeout(function() { 
    var highchart = document.querySelector(".highcharts-container svg:last-of-type"); 
    highchart.setAttribute("viewBox", "0 0 1324 400"); 
}, 10); 

超時是確保highcharts來得及插入DOM中圖表。數據填充本身發生在初始化之後,所以10毫秒就可以了。