Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

make ZoomContainer work with real-time data #496

Merged
merged 1 commit into from
Jul 17, 2017
Merged

Conversation

chrisbolin
Copy link
Contributor

@chrisbolin chrisbolin commented Jul 14, 2017

fixes FormidableLabs/victory#646

@boygirl I'd love your thoughts on this. I don't think this is the perfect implementation - I found myself fighting the architecture a bit. I'll leave so comments in the code to explain why I made some of the choices. Totally happy to revisit this!

This approach doesn't added any extra domain calculations, so that's an upside :)

@@ -131,12 +132,23 @@ export const zoomContainerMixin = (base) => class VictoryZoomContainer extends b
const childComponents = React.Children.toArray(props.children);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix must be in modifyChildren or another part of the VictoryZoomContainer; it cannot just go in the event handlers (found in zoom-helpers.js). This is because if new data is added to a chart, the handlers don't get fired, but we must know whether to show the new data or stay "zoomed in."

domain = zoomDomain;
} else if (!zoomActive) {
// if user has zoomed all the way out, use the child domain
domain = child.props.domain;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

child.props.domain is already calculated for us, so this approach has no new computational overhead.

@chrisbolin chrisbolin requested a review from boygirl July 14, 2017 17:19
@boygirl
Copy link
Contributor

boygirl commented Jul 17, 2017

@chrisbolin Approved!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VictoryZoomContainer - hard to use with real-time / dynamic data
2 participants