-
Notifications
You must be signed in to change notification settings - Fork 145
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 example of canvas to png data loader #1510
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this seems useful. A few remarks as I read the code.
|
||
</div> | ||
|
||
The above data loader lives in `data/us-map.png.js`, so we can access the image using `data/us-map.png`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be us-map.png.js
instead? not really “data”, maybe, if it's already a baked-in visualization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm agnostic on the approach. I put it there because I saw a similar path in the Python to PNG example. If you want me to change it here, I'm happy to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I don't know… we can leave it like this for now :)
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
Co-authored-by: Philippe Rivière <[email protected]>
I think we also want to use double resolution (for retina screens) — this is hidden in |
What method would you like to see used for this? |
merged as 661e0ff thanks! |
Great. Would you want a companion example that loaded a d3 SVG graphic into a PNG? |
I'm not sure what's best. I've already prepared a resource (but not shared as an "example" yet) explaining how to do SSR in png and svg with Plot: I wonder if it makes sense to create one "example" for each case, or if we shouldn't instead make an example that shows the different techniques (that means 8 combinations of D3 v Plot, png v svg, and dark v light). |
I'd defer to you all on the right presentation. My thing: Being able to render out big data-heavy graphics made with d3 into PNG is a very useful use case for your loaders in news publishing. Show it off! |
I propose adding this example, which shows how you can use Node.JS in a data loader to serve a canvas map as a PNG. I currently use this pattern to render large amounts of data in lightweight static files.
I used the official d3 example of how to make a canvas map to put together this demo.