vtforester
vtforester

Reputation: 683

Dojo pie chart very small due to labelOffset

I am working with Dojo 1.9.3 and want to have a pie chart fill the space of it's container.

The following jsfiddle shows the chart sized very small due to the label offset. Does anyone know how to keep the label offset (e.g. outside the pie chart) and size the chart more appropriately.

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
});

Upvotes: 0

Views: 830

Answers (2)

Daniel Kurtz
Daniel Kurtz

Reputation: 76

It's about a year old, but I was looking into an unrelated issue I had with the size of a chart so I thought I'd play around with your jsfiddle. I have updated the jsfiddle to make the chart appear bigger.

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
});

Upvotes: 1

user3591823
user3591823

Reputation: 37

html code

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

You can try this code. And adjust your radius, labelOffset, labelStyle parameter.

  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
  });

Hope it will works fine.

Upvotes: 0

Related Questions