nychealth / EH-dataportal

Source code for the Environment & Health Data Portal
https://a816-dohbesp.nyc.gov/IndicatorPublic/
Apache License 2.0
11 stars 5 forks source link

Consider 'print visualization' option #1128

Closed mmontesanonyc closed 1 month ago

mmontesanonyc commented 2 months ago

Changes in #1127, especially removing the legend given better hover interaction, make me think about the use case of screenshotting/saving/printing visualizations, and how this conflicts with organizing information optimized for interaction.

I wonder if it would be good to have a "print visualization" button that activates a few other options, like:

Upon print button click, we could even open a modal with a bit of information on how to click the actions menu and save as PNG or SVG, with the visualization rendered in the modal.

mmontesanonyc commented 2 months ago

Potential implementation:

mmontesanonyc commented 2 months ago

@cgettings - branched off of hotfix-DE-pallette to work on a chart printer, on feature-chart-printer. Overall this works by having a printSpec variable, and on any given vegaEmbed(...) call, map.js or comparisons.js defines printSpec with the contents of the spec it's drawing (I threw var printSpec at the top of data.js but there may be a better place for it.), so we can pass it in to another vegaEmbed call later.

Also,

No rush on this but I'd love your thoughts on this approach.

Stil to come is adding some logic to print.js that modifies the spec - adding year and neighborhood to the map, adding the legend to the trend chart... This stuff actually may have to happen with renderMap and renderComparisons in order to use the indicator metadata, so I might wind up writing alt-specs in those functions.

mmontesanonyc commented 2 months ago

hey @etorem when you have a moment can you serve up this branch and take a look at a DE map or trend chart, and let me know what you think about the "print" option? curious for your take on the ux.

etorem commented 2 months ago

I think this looks nice!

mmontesanonyc commented 1 month ago

Rolling up work in #1127 which itself rolled up work in #1080 and developing a fairly significant release branch, this includes: