Skip to content
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

Add an option to bin the data before generating a heatmap #579

Merged
merged 4 commits into from
May 23, 2016

Conversation

manthey
Copy link
Contributor

@manthey manthey commented May 16, 2016

This is faster for large data sets, as fewer images are drawn to the canvas. It is slower for small data sets, as the binning takes some time. The default setting 'auto' will only bin if there are fewer bins than data points. The bin size may be auto-calculated (1/8 of the point radius) or set explicitly. Setting it explicitly to larger values will be faster but more and more wrong.

This is currently based on other PRs. It could be isolated if necessary.

@codecov-io
Copy link

codecov-io commented May 16, 2016

Current coverage is 73.12%

Merging #579 into master will increase coverage by 0.23%

@@             master       #579   diff @@
==========================================
  Files            82         82          
  Lines          7148       7216    +68   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           5208       5276    +68   
  Misses         1940       1940          
  Partials          0          0          

Powered by Codecov. Last updated by e4599eb...0f75d73

@aashish24
Copy link
Member

Thanks @manthey I will have a look at it.

This is faster for large data sets, as fewer images are drawn to the canvas.  It is slower for small data sets, as the binning takes some time.  The default setting 'auto' will only bin if there are fewer bins than data points.  The bin size may be auto-calculated (1/8 of the point radius) or set explicitly.  Setting it explicitly to larger values will be faster but more and more wrong.
@@ -26,6 +26,11 @@ var transform = require('./transform');
* be computed.
* @param {number} [updateDelay=1000] Delay in milliseconds after a zoom,
* rotate, or pan event before recomputing the heatmap.
* @param {boolean|number|'auto'} [binned='auto'] If true or a number,
Copy link
Member

Choose a reason for hiding this comment

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

@manthey could we make it (binned) false by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

I thought auto would be a better default, since based on the rest of our default values, binning probably won't occur until you have ~200,000 data points (depending on screen size), at which point the speed improvement is useful.

Copy link
Member

Choose a reason for hiding this comment

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

Sure. I can see both sides. What happens if a user has dynamic update and let's say their number of points changes from 100,000 to 200,000 in that case now they will see a different behavior. Binning introduces / increases the visualization error (lack of a better word), that's why I thought that it should be false by default but I am with auto as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree -- either would be fine as the default. auto definitely introduces a discontinuity in the visualization as the number of points crosses the threshold (resizing the window could also do this). On the other hand, if you have a million data points, binning will be much faster. Your call on which should be the default.

Copy link
Member

Choose a reason for hiding this comment

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

let's go with auto 👍 we can always change it later depending on user's feedback.

Explicitly set the default example binning to 'auto' in case we ever change the default in the heatmap class.
Oddly, travis failed on the branch test but succeeded in the PR test.  I'll make the numbner point based on the reported viewport to see if that makes Travis happy.
@aashish24
Copy link
Member

LGTM 👍

@manthey manthey merged commit 06f2f01 into master May 23, 2016
@manthey manthey deleted the heatmap-binning branch May 23, 2016 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants