-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Explore: resize graph on window resize #13529
Conversation
The react dashboard grid uses a sizeMe lib, not sure that could be useful in this scenario |
I find the libs quite bloated. Some are useful because they polyfill the window object needed for SSR. But we'd need to revisit the whole code anyway when introducing that. |
sizeMe is bloated? In what way? looks very small an lean and isolates this interaction so much more cleanly. A lot better than manually hooking up events to window directly from the component and having to unsub on component did unmount. Also it handles cases that this solution does not, like hiding the sidebar (will not cause a resize event) but the available space for graph will increase. |
I mean the Graph could be simplified by wrapping it in sizeMe HOC that adds width, then you dont need to use jquery to calculate width in the draw function. |
Good points, I'll give it a try. |
@@ -68,7 +69,7 @@ const FLOT_OPTIONS = { | |||
// }, | |||
}; | |||
|
|||
class Graph extends Component<any, any> { | |||
class Graph extends Component<any, { showAllTimeSeries: boolean }> { |
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.
extract to interface?
interface State {
showAllTimeSeries: boolean;
}
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.
nice!
Fixes #13517