You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with the cols_nanoplot() function to add sparklines to my tables. While I like the interactive feature that displays min/max values on hover when viewed in HTML, I need a solution for static displays (like PDF exports or printed documents) where hover functionality isn't available.
Why This Feature Is Useful
Accessibility: Static min/max annotations would make sparklines more accessible to users who may have difficulty with activating hover interactions.
Graphic integrity: Without visible min/max values, it's difficult to gauge the scale of changes in a sparkline, especially when comparing multiple rows where the value ranges might differ significantly.
Consistent presentation: Ensuring that the same information is available regardless of viewing format (HTML, PDF, print) creates a more consistent user experience.
Minimum Working Example
Here's a simple example demonstrating the current behavior:
This creates sparklines where min/max values are only visible on hover. When exporting to PDF or printing, this information is lost.
Current behavior: When using cols_nanoplot(), min and max values are only visible on hover in HTML outputs. For instance, in the attached screenshot, the minimum (2) and maximum (9) are visible because my pointer hovered over this area.
Desired behavior: I'd like to add permanent min/max value annotations to each sparkline that would be visible in all output formats. Please note that I don't require other data values to be statically visible.
What I've Tried
I've asked both Claude and ChatGPT for solutions. They attempted several approaches to modify the sparkline HTML after creation:
Using text_transform() to parse the sparkline HTML and add min/max annotations
Trying to extract the data values from the sparkline's data attributes
Creating wrapper divs with min/max values positioned below the sparklines
All attempts have been unsuccessful due to challenges accessing the underlying data or properly modifying the HTML structure.
Potential Solutions?
I'm wondering if a future version of gt could add a feature to cols_nanoplot() with a parameter like show_minmax = TRUE that would add static annotations
Alternatively, has anyone found a reliable solution for this use case? Any guidance would be greatly appreciated!
Environment Information
gt package version: 0.11.1
R version: 4.4.3
Output format: HTML via Quarto and PDF via gtsave()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Issue Description
I'm working with the
cols_nanoplot()
function to add sparklines to my tables. While I like the interactive feature that displays min/max values on hover when viewed in HTML, I need a solution for static displays (like PDF exports or printed documents) where hover functionality isn't available.Why This Feature Is Useful
Accessibility: Static min/max annotations would make sparklines more accessible to users who may have difficulty with activating hover interactions.
Graphic integrity: Without visible min/max values, it's difficult to gauge the scale of changes in a sparkline, especially when comparing multiple rows where the value ranges might differ significantly.
Consistent presentation: Ensuring that the same information is available regardless of viewing format (HTML, PDF, print) creates a more consistent user experience.
Minimum Working Example
Here's a simple example demonstrating the current behavior:
This creates sparklines where min/max values are only visible on hover. When exporting to PDF or printing, this information is lost.
Current behavior: When using
cols_nanoplot()
, min and max values are only visible on hover in HTML outputs. For instance, in the attached screenshot, the minimum (2) and maximum (9) are visible because my pointer hovered over this area.Desired behavior: I'd like to add permanent min/max value annotations to each sparkline that would be visible in all output formats. Please note that I don't require other data values to be statically visible.
What I've Tried
I've asked both Claude and ChatGPT for solutions. They attempted several approaches to modify the sparkline HTML after creation:
text_transform()
to parse the sparkline HTML and add min/max annotationsAll attempts have been unsuccessful due to challenges accessing the underlying data or properly modifying the HTML structure.
Potential Solutions?
I'm wondering if a future version of gt could add a feature to
cols_nanoplot()
with a parameter likeshow_minmax = TRUE
that would add static annotationsAlternatively, has anyone found a reliable solution for this use case? Any guidance would be greatly appreciated!
Environment Information
gtsave()
Beta Was this translation helpful? Give feedback.
All reactions