This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 145
dcc.Graph: Improve responsiveness, expose resize status, allow wrapper extension #706
Merged
Merged
Changes from 38 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
6a4a2b3
wip - responsive graph
d721038
render and layout strategies
6361f5b
unified render, overrideable responsive behavior
a02a986
cleanup
2f957bf
Merge branch 'dev' into 605-graph-resize
Marc-Andre-Rivet 33afc15
undo webpack changes
260c90b
Merge branch '605-graph-resize' of github.com:plotly/dash-core-compon…
ed02f5e
document `responsive`
c2fcd2c
format
3badeb9
comments
327a9e3
format
46aed75
clean up overrides
c3f6fd9
rework
0b78f42
typo
b36919d
Merge branch 'dev' into 605-graph-resize
Marc-Andre-Rivet b784df8
rework layout logic
dc6b4ae
- all graph responsiveness combos
de29b48
is True/False
9ba52e6
- default to responsive 'auto'
41527bf
update prop description
f0ba158
resize counter
79d3bfa
update tests
0d81609
changelog
860d133
update responsive docs
4555c68
lint
c8a5679
responsive relation with style
c01eb32
- private layout/config transform methods to customize plot behavior
28e9dd6
update tests
c6a2d4a
- remove counters (requires plotly.js 4392 to fully work)
577cc8b
div -> fragment wrapper
571db5a
lint
a30abcb
plot on transform functions update
71852a3
format
3e4de1c
use props arg
c60b59c
reduce meddling to a minimum when using `auto` mode - eval responsive…
ed1b823
update responsiveness and tests based on plotly.js' behavior (auto) w…
cd41f75
Due to react-resize-detector, need to move back to the div wrapper to…
68b9c8e
dash-graph and 'legacy' js-plotly-plot class
a59682e
Update dash-graph-resizing to dash-graph--pending
8beae49
Remove `dash-graph--pending` from scope
99b9a08
add it back...
74b08fc
- clean up className passing
fb218a5
- add pending class on `Plotly.react`
8addc80
Merge branch 'dev' into 605-graph-resize
Marc-Andre-Rivet d1a1dd5
update changelog
701809b
Merge branch '605-graph-resize' of github.com:plotly/dash-core-compon…
530ef65
Merge branch 'dev' into 605-graph-resize
Marc-Andre-Rivet cb77c3b
- update to plotly.js 1.51.3
b39406e
re-remove js-plotly-plot
56d883b
Clean up props usage
6867be2
clean up the clean up
c744ae9
clean up the clean up of the clean up
de59930
remove useless gitignore entry
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ import PropTypes from 'prop-types'; | |
|
||
import {asyncDecorator} from '@plotly/dash-component-plugins'; | ||
import LazyLoader from '../utils/LazyLoader'; | ||
import { | ||
privatePropTypes, | ||
privateDefaultProps, | ||
} from '../fragments/Graph.privateprops'; | ||
|
||
const EMPTY_EXTEND_DATA = []; | ||
|
||
|
@@ -101,13 +105,33 @@ class ControlledPlotlyGraph extends PureComponent { | |
} | ||
|
||
PlotlyGraph.propTypes = { | ||
...privatePropTypes, | ||
|
||
/** | ||
* The ID of this component, used to identify dash components | ||
* in callbacks. The ID needs to be unique across all of the | ||
* components in an app. | ||
*/ | ||
id: PropTypes.string, | ||
|
||
/** | ||
* If True, the Plotly.js plot will be fully responsive to window resize | ||
* and parent element resize event. This is achieved by overriding | ||
* `config.responsive` to True, `figure.layout.autosize` to True and unsetting | ||
* `figure.layout.height` and `figure.layout.width`. | ||
* If False, the Plotly.js plot not be responsive to window resize and | ||
* parent element resize event. This is achieved by overriding `config.responsive` | ||
* to False and `figure.layout.autosize` to False. | ||
* If 'auto' (default), the Graph will determine if the Plotly.js plot can be made fully | ||
* responsive (True) or not (False) based on the values in `config.responsive`, | ||
* `figure.layout.autosize`, `figure.layout.height`, `figure.layout.width`. | ||
* This is the legacy behavior of the Graph component. | ||
* | ||
* Needs to be combined with appropriate dimension / styling through the `style` prop | ||
* to fully take effect. | ||
*/ | ||
responsive: PropTypes.oneOf([true, false, 'auto']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allow users to define the behavior they want for their graph, allowing them to override the normal behavior for their |
||
|
||
/** | ||
* Data from latest click event. Read-only. | ||
*/ | ||
|
@@ -479,6 +503,8 @@ PlotlyGraph.propTypes = { | |
}; | ||
|
||
PlotlyGraph.defaultProps = { | ||
...privateDefaultProps, | ||
|
||
clickData: null, | ||
clickAnnotationData: null, | ||
hoverData: null, | ||
|
@@ -491,6 +517,7 @@ PlotlyGraph.defaultProps = { | |
layout: {}, | ||
frames: [], | ||
}, | ||
responsive: 'auto', | ||
animate: false, | ||
animation_options: { | ||
frame: { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
export const privatePropTypes = { | ||
_dashprivate_transformConfig: PropTypes.func, | ||
_dashprivate_transformFigure: PropTypes.func, | ||
}; | ||
|
||
export const privateDefaultProps = { | ||
_dashprivate_transformConfig: c => c, | ||
_dashprivate_transformFigure: f => f, | ||
}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plotly.js 1.51.3 with the promise fix 🎉