-
Notifications
You must be signed in to change notification settings - Fork 185
render API #501
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
Comments
We can’t change this API without breaking backwards compatibility, so I do not wish to redesign it. I agree we should document mark.render though. |
Would you be against passing facet as a fifth argument? |
I realized we are inconsistent with what we pass mark.render. Without faceting, we pass {index, scales, values, dimensions, axes}; with faceting we pass {index, scales, values, dimensions}. So, if we want to pass the current facet it would need to be a sixth argument, or we’d somehow need to squirrel it into one of the existing arguments. But aside from how I’m onboard with somehow exposing the current facet values to marks during rendering. |
One of the recurring frustrations with the current API is that render doesn't know who the parent SVG and the parent FIGURE will be. This makes it awkward to build interactivity, since we have to wait (asynchronously) for the It's still probably too early to cast this in concrete, but it should be included in the discussion about the API. Having the 6th argument be {facet} would allow to extend it in the future to {facet, parentSVG, figure} or something else (a callback when the figure is added to the DOM, maybe). |
I did a bit of documentation in https://observablehq.com/d/cfdce446a293784f ; but def. not a blocker for 0.2 |
superseded by #1263 |
#498 has introduced function marks:
() => svg node
That render function is called like any other and receives as input (data, scales, channels, dimensions), with empty data and channels, all the instantiated scales, and complete dimensions.
It would be useful I think to design and document this API (for all marks). The changes I'd suggest would be:
https://observablehq.com/d/cfdce446a293784f
The text was updated successfully, but these errors were encountered: