Opened 6 years ago

Closed 3 years ago

#17472 closed enhancement (patchwelcome)

Pie plots should provide a minimal threshold value for pie slices

Reported by: mailtorakeshp Owned by:
Priority: undecided Milestone: 1.13
Component: Charting Version: 1.6.2
Keywords: Cc:
Blocked By: Blocking:

Description

Hi, Please take a look at the image that has been attached in this ticket.

There are 4 legends, so 4 sectors should be displayed; however, one sector is missing. I have even zoomed the browser to the maximum limit, but the sector is not even drawn.

The proportion/percentage of the missing sector (corresponding to 1st legend (in cyan color) with value $16) is 0.07%, when compared to the rest of the 3 sectors (Total is $22,210).

Is it because of the smaller proportion that the sector is not getting displayed?

If so, is there a way to fix this issue? I took a look at the API, but there wasn't much that I could use to fix the issue. Please let me know how to fix this.

Thanks R

Attachments (1)

PieChartIssue.JPG (9.2 KB) - added by mailtorakeshp 6 years ago.
Only 3 sectors are shown in the pie chart. The one with Cyan color is missing.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by mailtorakeshp

Attachment: PieChartIssue.JPG added

Only 3 sectors are shown in the pie chart. The one with Cyan color is missing.

comment:1 Changed 6 years ago by mailtorakeshp

If I change the value for 'Total V' from $16 to something like $2600 (1% of the total proportion), a thin line shows up. If I keep increasing the amount to higher values, the sector's width increases, which is normal.

However, when the value is $16 (0.07%), is it possible to display at least a thin line, instead of not showing anything?

comment:2 Changed 6 years ago by mailtorakeshp

Can someone please let me know what the issue is and how to fix it?

comment:3 Changed 6 years ago by cjolif

Resolution: invalid
Status: newclosed

As you realized by yourself the slice is so thin in your case it is not visible so this is not really a defect. What you can do however:

  • put a stroke on your chart? The stroke will always be visible
  • make sure to not directly input your data in the chart but normalize them before so that you always have a minimum (you will then need to make sure to adjust the label so that the legend does not display a "fake" value).

comment:4 Changed 6 years ago by mailtorakeshp

I still think its a defect and I don't have an option to reopen the ticket. Please let me know how to reopen a defect; I don't see such option here.

From the API, there is no way of setting a minimum (threshold) value for a slice/sector. What you are suggesting is a hack. The hack may/may-not work (I'm not sure at this point), but why not add a property something like 'lowThreshold' to the API?

Last edited 6 years ago by mailtorakeshp (previous) (diff)

comment:5 Changed 6 years ago by cjolif

Resolution: invalid
Status: closedreopened
Summary: Pie Chart sector is not renderingPie plots should provide a minimal threshold value for pie slices
Type: defectenhancement

Adding new API is enhancement not defect. I'm re-opening as an enhancement. Feel free to contribute.

comment:6 Changed 6 years ago by mailtorakeshp

Thanks, cjolif for the idea.

Fixing dojox.charting.plot2d.Pie.js is going to be time consuming, so I'm using the following (working) hack for time being. A 1% slice will always show up and it is small enough to be represented for slices smaller than 1% in proportion.

Normalize function: =================== normalizePieSlice = function(singleValue, totalValue) {

var minThresholdPct = 1; var pct = (singleValue/totalValue) * 100; return (pct < minThresholdPct ? (totalValue * minThresholdPct)/100 : singleValue);

};

pushing a normalized value to the series: ======================================== series.push( {

y : normalizePieSlice(singleValue, totalValue), legend: ......, tooltip: "xyz is " + singleValue, .......

)};

Only value is normalized, tooltip remains the same.

Last edited 6 years ago by mailtorakeshp (previous) (diff)

comment:7 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: reopenedclosed

Given that no one has shown interest in creating a patch in the past 2+ years, I'm closing this as patchwelcome. Please let us know if you would like to get involved in helping make this change to Dojo!

Note: See TracTickets for help on using tickets.