Skip to content

1.0? - #19

Open
Fil wants to merge 21 commits into
masterfrom
no-rebin-api
Open

1.0?#19
Fil wants to merge 21 commits into
masterfrom
no-rebin-api

Conversation

@Fil

@Fil Fil commented Sep 26, 2019

Copy link
Copy Markdown
Member

Alternative to #17 ; in this version, changing accessors does not result in the (awkward) rebinning of already-present points.

Closes #1 #3 #5 #8 #18.

Fil added 17 commits September 3, 2019 09:30
- using hexbin.context([context]), hexbin.hexagon() and hexbin.mesh() support canvas ; fixes #1
- incremental updates: bins.add(point); bins.addAll(points); remove(point); bins.removeAll(points); fixes #3
- hexbin.angle([angle]) sets or reads an angle (default 0°, use 90° for flat-topped hexagons) ; fixes #8
…ifferent order)

note: I made it be a setter, which sort of duplicates hexbin(data)
- remove .data(), instead use bins.flat() to get the data, and hexbin() to update without adding points.
- don't rebin aggressively when changing parameters, only on update ie when calling hexbin()
- all the new methods are on hexbin not on bins
Including a bit more centers solves the issue.

The solution breaks a test on centers() in the angle=0 case, which we could keep backwards compatible by testing for angle===0; but I don't think it's a problem if we have a few more centers (better safe than sorry).
test canvas

An optional [translate] argument in binhex.hexagon() allows easier manipulation under canvas, for example to draw all the hexagons in one context.fill() without having to do lots of context.save/translate/restore.
@Fil
Fil requested a review from mbostock September 26, 2019 13:07
@Fil Fil mentioned this pull request Sep 26, 2019
Closed
@Fil

Fil commented Sep 26, 2019

Copy link
Copy Markdown
Member Author

i've updated https://observablehq.com/@fil/d3-hexbin-playground to use the new code.

@Fil

Fil commented Nov 5, 2019

Copy link
Copy Markdown
Member Author

@mbostock can we go with this? It would make a nice 1.0 version

@Fil Fil mentioned this pull request Nov 20, 2019
29 tasks
@Fil Fil changed the title 0.3 - no rebin 1.0? May 19, 2020
@Fil Fil added the feature label Jul 10, 2020
@Fil

Fil commented Jul 29, 2020

Copy link
Copy Markdown
Member Author

Here is another use case for the angle and context methods https://observablehq.com/@fil/graphene-moire-1-1

@Fil Fil mentioned this pull request Mar 14, 2022
16 tasks
@StevenCellist

Copy link
Copy Markdown

@Fil any update on this?

@Fil

Fil commented Feb 19, 2025

Copy link
Copy Markdown
Member Author

Wow I forgot about this. It's only been 4½ years! I might have to review the code a bit. Have you tried it?

Comment thread README.md
@@ -9,7 +9,7 @@ Hexagonal binning is useful for aggregating data into a coarser representation f
If you use NPM, `npm install d3-hexbin`. Otherwise, download the [latest release](https://github.com/d3/d3-hexbin/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-hexbin.v0.2.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_hexbin` global is exported:

@Fil Fil Feb 19, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
If you use NPM, `npm install d3-hexbin`. Otherwise, download the [latest release](https://github.com/d3/d3-hexbin/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-hexbin.v0.2.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_hexbin` global is exported:
If you use NPM, `npm install d3-hexbin`. Otherwise, download the [latest release](https://github.com/d3/d3-hexbin/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-hexbin.v1.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_hexbin` global is exported:

(I think we'll want to update the distribution pattern.)

@StevenCellist

Copy link
Copy Markdown

Less than 5 years ago should still be OK, right? 😉
I actually haven't tried it but am looking at the features with one eye for a while - I'm about to add a live-data feature to my website. Wouldn't want to redraw the whole screen for a single datapoint :)
And then I noticed your profile is still active, so thought I'd drop a ping. Glad to see you're still around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Support Canvas.

2 participants