Adding negative values on graphics bar#58
Open
bougetalife wants to merge 3 commits intotimqian:masterfrom
Open
Adding negative values on graphics bar#58bougetalife wants to merge 3 commits intotimqian:masterfrom
bougetalife wants to merge 3 commits intotimqian:masterfrom
Conversation
Owner
|
Thanks, @bougetalife, the format seems not right, make sure you run |
timqian
requested changes
Dec 13, 2019
src/Bar.js
Outdated
| backgroundColor: 'white', | ||
| isShorterLabelActive: false, | ||
| charNum: 5, | ||
| shorterLabels: [], |
Owner
There was a problem hiding this comment.
Let's focus on Adding negative values on bar chart for this PR first and not changing the options for bar chart.
Because:
- we need to make sure these options not only valid for bar but also other charts
- For shorter labels, adding 3 more options seems too overwhelming. We can discuss this in another issue or PR
src/Bar.js
Outdated
| .attr('height', (d) => this.height - yScale(d)) | ||
| // .attr('y', (d) => yScale(d)) | ||
| // .attr('height', (d) => this.height - yScale(d)) | ||
| .attr('y', (d) => getRectY(this.height,d) ) /////////////////////// |
Owner
There was a problem hiding this comment.
unnecessary comments should be removed
Author
timqian
reviewed
Jan 7, 2020
| const yScale = getYScale(this.height, Math.min(...allData), Math.max(...allData)) | ||
|
|
||
| function getYScale(height,min,max){ | ||
| if (min < 0 && max > 0 ) |
Owner
There was a problem hiding this comment.
@bikingbadger Sorry for the late reply
I see many formatting issues in this PR.
e.g. here is an unnecessary space
Can you lint the code via npm run lint, and fix the formatting issues?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
New Feature
We can use Bar chart with negative values
Option is added in order to obtain shorter labels on X axis. Label length remains the same on each bar when mouse is over.
Screenshot before and after this change
BEFORE

AFTER
