Skip to content
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

✨ (static charts) make charts mobile-friendly #2977

Merged
merged 25 commits into from
Jan 9, 2024

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Dec 1, 2023

Collection of small improvements to make static charts more mobile-friendly. Some changes apply to static+mobile charts only, others apply to all charts (interactive and static).

For all charts:

  • Font size changes
    • Rather than micro-managing font sizes for the special case of static+mobile charts, I rely on the baseFontSize to scale all font sizes up
    • To make that work, I have adjusted some font sizes to make sure it looks good for all cases (desktop/mobile, interactive/static)
    • I compiled a list of font sizes currently in use here; the table also denotes the changes I made
    • The biggest change I made is decreasing the font size of tick labels by a few pixels (0.9 -> 0.75, i.e. 14.4px -> 12px for baseFontSize = 16px)
  • Updated colours in the chart to use Grapher's dark and light colours
  • Updated the opacity used for bars and areas (0.8)
  • Draw a white outline around value labels that are rendered into the chart area and might overlap with grid lines (DiscreteBar and StackedDiscreteBar)
  • Make the detail's font size respect the base font size
  • Make entity labels in ScatterPlots respect the base font size

For static+mobile charts only:

  • Increased the thickness of axis lines
  • Increased the thickness of lines in LineCharts and SlopeCharts
  • Increased the thickness of lines in Maps
  • Hide line markers in LineCharts
  • Changed the text colour of the subtitle, footer and axis labels
  • Remove underlines for links in the footer
  • If the footer text is long, decrease its font size
  • SlopeChart: Hide the vertical axes on the sides

  • Mobile optimizations are also applied to thumbnails generated for social media:

@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch from 32a86a1 to 16f75c8 Compare December 1, 2023 17:13
@sophiamersmann sophiamersmann force-pushed the add-export-tab-in-admin branch from f680c74 to c1c793b Compare December 4, 2023 09:05
@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch from 16f75c8 to ec64f36 Compare December 4, 2023 09:05
@sophiamersmann sophiamersmann force-pushed the add-export-tab-in-admin branch from c1c793b to 5df7ecb Compare December 11, 2023 18:29
@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch 11 times, most recently from d929dad to c24739c Compare December 15, 2023 10:44
@sophiamersmann sophiamersmann force-pushed the add-export-tab-in-admin branch from 29f3827 to 20a7a6b Compare December 15, 2023 17:31
@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch from c5152ba to 53dc839 Compare December 15, 2023 17:31
@sophiamersmann sophiamersmann marked this pull request as ready for review December 18, 2023 10:21
@sophiamersmann sophiamersmann force-pushed the add-export-tab-in-admin branch from 20a7a6b to b829855 Compare December 19, 2023 16:11
@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch from 0a310a8 to 02c6628 Compare December 19, 2023 16:11
Copy link

github-actions bot commented Jan 3, 2024

This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected.

@sophiamersmann sophiamersmann force-pushed the export-charts-for-mobile branch from 4802648 to f59fec2 Compare January 9, 2024 15:20
@sophiamersmann sophiamersmann merged commit 89ddd73 into master Jan 9, 2024
10 of 14 checks passed
@sophiamersmann sophiamersmann deleted the export-charts-for-mobile branch January 9, 2024 15:21
@sophiamersmann
Copy link
Member Author

It's a little unhinged, but why not 😅

export const GRAPHER_FONT_SCALE_9_6 = 9.6 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_10 = 10 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_10_5 = 10.5 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_11 = 11 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_11_2 = 11.2 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_12 = 12 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_12_8 = 12.8 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_13 = 13 / BASE_FONT_SIZE
export const GRAPHER_FONT_SCALE_14 = 14 / BASE_FONT_SIZE

Merged in the next PR!

@danyx23
Copy link
Contributor

danyx23 commented Jan 10, 2024

Nice, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants