-
Notifications
You must be signed in to change notification settings - Fork 95
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
Chart improvements #989
Merged
Merged
Chart improvements #989
Conversation
This file contains 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
Contributor
bjoernricks
commented
Oct 2, 2018
- Allow to render different icons in overlay
- Allow to toggle legend
- Allow to toggle 2d/3d donut view
- Allow to store chart specific data
- Fix stuff 😁
Move react state methods up.
hasSvg can always be derived in render.
Add icon to toggle displaying the legend of charts.
Allow to override the icon prop of DataDisplay to render different icons for a chart.
Allow to set and get state for charts in DataDisplay. Setting the state will also re-render the children which wouldn't be possible if a chart keeps the state internally in it's component. At a first step the showLegend state is put into the chart state. In future this chart state will be saved in the redux store too.
Chart modules should not depend on dashboard components. Charts components are only for displaying some data and dashboards for orchestrating different displays which might be charts.
Charts must be updates at least if data, width or height props have changed.
Rename displayLegend of Bar chart to showLegend and add showLegend to Donut chart.
If the legend is displayed the Bar chart must be rendered again after the ref is set. Also update chart to use new React.createRef API.
We have mostly all proptypes at the bottom of the js module. Therefore it's demanding to search for the LineChart proptypes.
Use showLegend prop instead of displayLegend at LineChart.
Never crash if svg or download refs aren't set. This should not ever happen but it is saver to check for this case.
When the svg ref is set in a child of DataDisplay the component will not be re-rendered necessarily. Therefore the svg ref may be set but the icon is still not displayed. Therefore add an external prop to deactivate the svg download icon on demand.
When displaying a table it shouldn't be possible to download a svg.
Only re-calculate state from width if the width has changed actually. Th LineChart did crash because the width has been re-calculated when hovering over the LineChart to display the tooltips. This lead to an infinite loop. Also fix calculation of the width. It uses the same pattern as the donut chart now.
A chart should be re-rendered if the showLegend prop has changed.
Codecov Report
@@ Coverage Diff @@
## master #989 +/- ##
=========================================
+ Coverage 9.11% 9.11% +<.01%
=========================================
Files 818 821 +3
Lines 26695 26744 +49
Branches 5737 5717 -20
=========================================
+ Hits 2432 2437 +5
- Misses 21908 21947 +39
- Partials 2355 2360 +5
Continue to review full report at Codecov.
|
Use initialState instead of initialChartState because the internal state variable name isn't visible outside of DataDisplay component. For children it's only the state.
swaterkamp
approved these changes
Oct 2, 2018
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.