2014-07-11 13 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 
});