fix barCharts rendering for zero values #41
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #40
This is a fix for regression that was caused when d3 package was
replaced by d3-scale package and others. Latest version of
d3-scale
package introduced change related to the issue d3/d3-scale#117
that caused to half fill barChart for 0 value.
Now,
normalizeClosedDomain
checks if domain start and end valuesare equal or not, and in case they are equal, it increases last value
by one. Note, it doesn't change actual values, but only domain range of
possible values.
Most of the time barChart renders bars with range from 0% to 100% and
it should show 0% value when we have values [0, 0].
for range [0, 0] and it equals 50% (for range0 from % to 100%).
will return 0%