2014-07-11 11 views
0

我正在使用Dojo 1.9.3,並希望有一個餅圖填充它的容器空間。Dojo餅圖非常小,因爲labelOffset

下面的jsfiddle顯示由於標籤偏移量而使圖表尺寸非常小。有誰知道如何保持標籤的偏移量(例如在餅圖之外)並更適當地調整圖表的大小。

http://jsfiddle.net/a7JLR/89/

var c = new Chart("reportChartDiv"); 
c.addPlot("default", { 
    type: Pie,  
    radius: 40, 
    labels: true, 
    ticks: false, 
    fixed: true, 
    precision: 1, 
    labelOffset: -30, 
    labelStyle: "default", 
    htmlLabels: true 
}); 
+0

我發現同樣的,真正需要它 – endamaco

回答

0

HTML代碼

<div style="position:relative; width:550px;height:250px;border:solid 1px blue;"> 
    <div id="reportChartDiv" style='position:absolute; width:100%; height:100%;'></div> 
</div> 

你可以試試這個代碼。並調整你的半徑,labelOffset,labelStyle參數。

var c = new Chart("reportChartDiv"); 
    c.addPlot("default", { 
    type: Pie,  
    radius:120, 
    labels: true, 
    ticks: false, 
    fixed: true, 
    precision: 1, 
    labelOffset:30, 
    labelStyle: "columns", 
    htmlLabels: true 
    }); 

希望它能正常工作。

+0

一個適當的解決這個問題是有幫助的,尤其是labelStyle,但我真的需要容器大小,以保持它在撥弄。 – vtforester

1

大約一歲,但我正在研究一個與圖表大小無關的問題,所以我想我會玩你的jsfiddle。我已更新jsfiddle以使圖表看起來更大。

http://jsfiddle.net/danielkurtz/a7JLR/467/jsf

var c = new Chart("reportChartDiv"); 
c.addPlot("default", { 
    type: Pie,  
    //radius: 40, 
    radius: 50, 
    labels: true, 
    ticks: false, 
    fixed: true, 
    precision: 1, 
    //labelOffset: -30, 
    labelOffset: -10, 
    //labelStyle: "default", 
    labelStyle: "columns", 
    htmlLabels: true 
});