-
Notifications
You must be signed in to change notification settings - Fork 313
Description
d3-shape/src/offset/diverging.js
Line 5 in b8279d6
if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) { |
Hi,
I had a problem with y values in diverging barcharts. If dy == 0, it is converted as positive datapoints group. But 0 is neither positive nor negative. Therefore is group of negative datapoints, where value is 0, not more correct converted. I changed in your example some data values to 0 and you can see results: https://jsfiddle.net/oy21nzq0/1/ . Negative datapoints had in your example cherries and dates. You can see in console d3.stack() converted arrays for each group.
I.e. for cherries look likes this:
0: (2) [5760, 5760, data: {…}]
1: (2) [-960, 0, data: {…}]
2: (2) [1600, 1600, data: {…}]
3: (2) [-640, 0, data: {…}]
how you see 0 and 2 are not correct. Both are positive. Correct is below:
0: (2) [0, 0, data: {…}]
1: (2) [-960, 0, data: {…}]
2: (2) [0, 0, data: {…}]
3: (2) [-640, 0, data: {…}]
I fixed this problem, where I changed d3.stackOffsetDiverging https://jsfiddle.net/oy21nzq0/ . Please Check this FIX and say, if it's a good solution.
Best Regards
Davit