Opened 10 years ago
Closed 10 years ago
#12228 closed defect (duplicate)
Error in the Pie Legend for zero or negative values
Reported by: | vvoovv | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | future |
Component: | Charting | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
If a data set contains zero or negative values, then 'dyn' array filled in plot2d/Pie.js containes only positive values from the data set. But filteredRun and slices arrays in widget/Legend.js contains all values.
This leads to the error in the following code snippet in widget/Legend.js:
dojo.forEach(slices, function(x, i){
this._addLabel(t.dyn[i], t._getLabel(x * 100) + "%");
}, this);
The error can be corrected if we substitute
var filteredRun = df.map(t.run.data, "Math.max(x, 0)");
with
var filteredRun = df.filter(t.run.data, "x>0");
in widget/Legend.js
The test file is attached. It should be run to charting/tests
Attachments (2)
Change History (5)
Changed 10 years ago by
Attachment: | my_test_pie2d_negative.html added |
---|
comment:1 Changed 10 years ago by
Milestone: | tbd → future |
---|---|
Status: | new → assigned |
comment:2 Changed 10 years ago by
I attach additional test case with array of objects. The fix to this ticket should be test against to test cases: 1) Array of numbers (e.g. chart.addSeries("Series A", [4, 0, 0, 1]); ) 2) Array of objects (e.g. chart.addSeries("Series A", [{y:4}, {y:0}, {y:0}, {y:1}]); )
comment:3 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
#12334 is similar but with a patch. Closing this one.
test case