Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stackOffsetDiverging: 0 values are converted as positive #140

Closed
dsvanidze opened this issue Jan 5, 2019 · 1 comment
Closed

stackOffsetDiverging: 0 values are converted as positive #140

dsvanidze opened this issue Jan 5, 2019 · 1 comment

Comments

@dsvanidze
Copy link

dsvanidze commented Jan 5, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants