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

Support Canvas. #1

Open
mbostock opened this issue Dec 8, 2015 · 2 comments · May be fixed by #19
Open

Support Canvas. #1

mbostock opened this issue Dec 8, 2015 · 2 comments · May be fixed by #19

Comments

@mbostock
Copy link
Member

mbostock commented Dec 8, 2015

Should hexbin.hexagon implement the symbol type interface? But it has a specific radius, not an arbitrary size…

Should the hexagon method take a context? But then you have to construct a path buffer manually?

Should the hexbin take a context? And then render like a shape? (Rendering either a mesh of individual hexbins?) Maybe?

@mbostock mbostock changed the title hexbin.hexagon should support Canvas. Support Canvas. Dec 8, 2015
@ghost
Copy link

ghost commented Jan 1, 2016

Sorry for the delay in replying to this pull request.

Here's what I think so far (subject to major revisions):

  • Should hexbin.hexagon implement the symbol type interface? -- I don't think so since I can't imagine a situation where it would be useful in an ordinal scale like all the other symbols (if there is such a use case, let me know). As you mentioned above, converting from a size to radius might require some arithmetic that could get tricky.
  • Should the hexagon method take a context? -- I'm not sure exactly what this question means, could you please clarify?
  • Should the hexbin take a context? And then render like a shape? -- I feel the answers to these are yes and yes in order to maintain maximum compatibility with d3-shape as well as allow rendering to either SVG or Canvas web interfaces.

Would love to hear your thoughts. Also, I may be wrong on any/all of this, so please feel free to correct any errors.

@mbostock mbostock self-assigned this Jun 29, 2016
@mbostock mbostock mentioned this issue Jun 29, 2016
@syntagmatic
Copy link
Contributor

A v3 version of d3-hexbin that takes a Canvas context here: http://bl.ocks.org/syntagmatic/002ef2fb5c1dc2df5821

My opinion is d3-hexbin shouldn't deal directly with Canvas or SVG path strings. It should output arrays of coordinates. Turning that array into a path string or a Canvas subroutine should be a convenience method or a separate utility like d3-path.

But practically since the plugin already supported SVG, adding a convenient way to render to Canvas instead would be nice. In this case, the API should be similar to d3.geoPath. A method to access the raw coordinates would still be useful.

@ghost ghost added the v1-milestone label Sep 10, 2016
@mbostock mbostock removed their assignment Sep 19, 2016
Fil added a commit that referenced this issue Aug 2, 2019
- 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
@Fil Fil mentioned this issue Aug 2, 2019
Closed
Fil added a commit that referenced this issue Sep 3, 2019
- 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
@Fil Fil linked a pull request Sep 26, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants