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

add downsample prop to VictoryZoomContainer #503

Merged
merged 3 commits into from
Aug 2, 2017
Merged

Conversation

chrisbolin
Copy link
Contributor

@chrisbolin chrisbolin commented Jul 28, 2017

downsample prop on VictoryZoomContainer.

Downsamples according to the dimension prop (defaults to "x" if dimension is not set).

Assumes data is sorted by dimension. (which is the case with almost all large time-series data) Need to make sure we note this in the docs.

Performance gains are pretty great...
Before: 1,000 points render at 3.5 FPS.
After: 100,000 render at 8 FPS.

@chrisbolin
Copy link
Contributor Author

with downsample and without, on 5,000 points. 15 FPS vs. 0.75 FPS. 20x improvement.

jul-28-2017 01-06-50 downsample

Copy link
Contributor

@boygirl boygirl left a comment

Choose a reason for hiding this comment

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

Approved pending extracting downsampling method

@@ -70,6 +78,10 @@ export const zoomContainerMixin = (base) => class VictoryZoomContainer extends b
}
}];

constructor(props) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh total mistake!

// core downsampling algo

// important: assumes data is ordered by dimension
// get the start and end of the data that is in the current visible domain
Copy link
Contributor

Choose a reason for hiding this comment

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

You can check on the sortKey prop

@chrisbolin
Copy link
Contributor Author

Requires FormidableLabs/victory-core#276 now

if (startIndex !== 0) { startIndex -= 1; }
if (endIndex !== -1) { endIndex += 1; }

const visableData = data.slice(startIndex, endIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: visableData -> visibleData

@boygirl boygirl merged commit 5a32ceb into master Aug 2, 2017
@boygirl boygirl deleted the downsample-zoom branch August 2, 2017 22:36
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.

2 participants