我正在使用Dojo 1.9.3并想要一个饼图填充它的容器空间。
以下jsfiddle显示由于标签偏移,图表的大小非常小。有没有人知道如何保持标签偏移(例如在饼图之外)并更适当地调整图表的大小。
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 :(得分: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
});
答案 1 :(得分: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>
您可以尝试使用此代码。并调整你的radius,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
});
希望它能正常运作。