Opened 9 years ago
Closed 7 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)
Change History (8)
Changed 9 years ago by
Attachment: | PieChartIssue.JPG added |
---|
comment:1 Changed 9 years ago by
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 9 years ago by
Can someone please let me know what the issue is and how to fix it?
comment:3 Changed 9 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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 9 years ago by
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?
comment:5 Changed 9 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Summary: | Pie Chart sector is not rendering → Pie plots should provide a minimal threshold value for pie slices |
Type: | defect → enhancement |
Adding new API is enhancement not defect. I'm re-opening as an enhancement. Feel free to contribute.
comment:6 Changed 9 years ago by
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.
comment:7 Changed 7 years ago by
Milestone: | tbd → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | reopened → closed |
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!
Only 3 sectors are shown in the pie chart. The one with Cyan color is missing.