Opened 6 years ago

Closed 3 years ago

#17248 closed enhancement (patchwelcome)

The radius of pie chart is different when labelOffset is set with a negative number and there is only one slice.

Reported by: jongeuncha@… Owned by: cjolif
Priority: undecided Milestone: 1.13
Component: Charting Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


In Pie.js, when labelOffset is a negative value, r is re-calculated.

if(this.opt.labelOffset < 0){
    r = Math.min(rx - 2 * shift, ry - size) + this.opt.labelOffset;

With this condition, when there is only one slice, circle.r is used as a radius.

if(slice >= 1){
    // whole pie
    specialFill = this._plotFill(theme.series.fill, dim, offsets);
    specialFill = this._shapeFill(specialFill,
            x: - circle.r, y: - circle.r,
	    width: 2 * circle.r, height: 2 * circle.r
    specialFill = this._pseudoRadialFill(specialFill, {x:, y:}, circle.r);
    var shape = s.createCircle(circle).setFill(specialFill).setStroke(theme.series.stroke);
    this.dyn.push({fill: specialFill, stroke: theme.series.stroke});

	o = {
    	    element: "slice",
	    index:   i,
	    shape:   shape,
	    x:       i,
	    y:       typeof v == "number" ? v : v.y,
	    cr:      r
	eventSeries[i] = o;
    return false;	// we continue because we want to collect null data points for legend

When drawing fans, r is used as a radius.

Change History (4)

comment:1 Changed 6 years ago by bill

Component: DojoX DrawingCharting

You meant for this to be filed against Charting, not dojox/drawing, right?

comment:2 in reply to:  1 Changed 6 years ago by jongeuncha@…

Yes this bug is against Charting. Thanks for clarification!

Replying to bill:

You meant for this to be filed against Charting, not dojox/drawing, right?

comment:3 Changed 6 years ago by cjolif

Owner: set to cjolif
Status: newassigned
Type: defectenhancement

I think this is (unfortunately?) kind of "on purpose". Indeed when there is single slice even if you have a negative labelOffset the single label is always drawn inside. I agree this could be different. I have just mixed feelings about changing that now as it stayed like that for years. At least seems more like a enhancement than a fix to me.

Note also that even if labelOffset was taken into account the resulting radius would not necessarily be exactly the same in single slice or multiple slices because it also take the labels size into account.

comment:4 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: assignedclosed

Given that no one has shown interest in creating a patch in the past 2+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.