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:


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 =, "Math.max(x, 0)");


var filteredRun = df.filter(, "x>0");

in widget/Legend.js

The test file is attached. It should be run to charting/tests

Attachments (2)

my_test_pie2d_negative.html (1.3 KB) - added by vvoovv 10 years ago.
test case
my_test_pie2d_negative2.html (1.3 KB) - added by vvoovv 10 years ago.
array of objects

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by vvoovv

Attachment: my_test_pie2d_negative.html added

test case

comment:1 Changed 10 years ago by Eugene Lazutkin

Milestone: tbdfuture
Status: newassigned

comment:2 Changed 10 years ago by vvoovv

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

Changed 10 years ago by vvoovv

array of objects

comment:3 Changed 10 years ago by Eugene Lazutkin

Resolution: duplicate
Status: assignedclosed

#12334 is similar but with a patch. Closing this one.

Note: See TracTickets for help on using tickets.