-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Image download #1931
feat: Image download #1931
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
3f1cbe2
to
5864301
Compare
3e01fa7
to
5c20064
Compare
5c20064
to
59e2be3
Compare
...in order so we don't have to use i18n provider when making a screenshot.
ded17e5
to
6562a3e
Compare
…shots ...so we can get actual height, which is problematic when we clone the node and need to get chart height.
...as it can cover half of the map in the dashboard view.
0bd6a14
to
51dec9e
Compare
51dec9e
to
7f9c74c
Compare
7f9c74c
to
4403527
Compare
4403527
to
4fa27a1
Compare
4fa27a1
to
d66cec2
Compare
Thank you for this @bprusinowski LGTM! I tested on Chrome and didn't encounter any issues. |
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.
LGTM 🎉 Well done @bprusinowski
@@ -403,6 +403,8 @@ export const MapComponent = () => { | |||
initialViewState={defaultViewState} | |||
mapLib={maplibregl} | |||
mapStyle={mapStyle} | |||
// Important so we can take a screenshot of the map |
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.
Do we still need this comment?
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 would say yes, as preserveDrawingBuffer
is false
by default and can decrease the performance of the map, the comment should make sure that we don't remove it and unknowingly break screenshotting of the maps :)
|
||
return componentIds | ||
.map((id) => components.find((component) => component.id === id)) | ||
.filter(truthy); // exclude potential joinBy components |
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.
Do we still need this comment?
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.
Here I would also say yes, as I wouldn't know why we need to use truthy
for – in this case, we have a connection between using it and joinBy
dimensions. Maybe it would be better to have something like
const excludeJoinByComponent = (c: Component) => truthy(c);
but I think a comment should suffice here 👍 It was a bit of a pain to catch all the edge-cases of merging of cubes, I'd rather keep more context in places related to them 🥹
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 think comments that describe a "clear" logic should be generally removed, like this:
// Find a component
const component = components.find(c => c.id === id);
but when they are related to other, connected parts of the code or generally are not "obvious", it's okay to use them 👍
The whole flow works perfectly. 🎉 I tested on Chrome. On Safari I was always landing on the search page. Somehow the link did not correctly redirect. Not sure why. But anyways it worked all perfectly. |
Contributes to #1928
This PR contains a first implementation of an image download feature, making it possible to download the images in PNG format, hide certain elements or modify the screenshot node on the fly.
Table charts are not possible to be screenshotted as of now.
How to test
Details
panel, interactive filters, time slider, brush, etc),Created with visualize.admin.ch
text at the bottom of the screenshot.Publisher
(contact point name and email if exist, cube creator or source otherwise),Dataset
(name and version) andPublish URL
(if the screenshotted chart was published). Note that the information comes with removed diacritics due to encoding limitations oftEXt
chunks.This would need to be investigated further.