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

Support custom font sizes #3584

Merged
merged 11 commits into from
Oct 18, 2021
Merged

Support custom font sizes #3584

merged 11 commits into from
Oct 18, 2021

Conversation

michael-yx-wu
Copy link
Contributor

@michael-yx-wu michael-yx-wu commented Oct 6, 2021

Add support for custom label font size in the following places:

  • Bar
  • StackedBar
  • Scatter
  • Axes (Category, Numeric, Time)

cc @Nifdee @billytrend

Testing

SVG measures distance to text elements using the text baseline instead of the top-left corner like it does with most other elements. I've taken care to redraw or reset the typesettable measurer's cache where applicable to make subsequent renders draw the text in the right place. When playing with the quicktests, please double check that the label is positioned reasonably as font size changes i.e. it doesn't crowd out other elements, it's hidden when there is no space to draw, etc.

⚠️ The blueprint-bot's quicktest link is broken, so I recommend testing by checking out the repo and running yarn start and navigate to the links below. Gifs show what you should expect to see. I recommend using node 8.10.0 with this repo, just to be consistent with the CI environment.

Bar

http://localhost:9999/quicktests/dev/index.html#functional/bar_plot_label_font_size
2021-10-11 21 48 16

Scatter

http://localhost:9999/quicktests/dev/index.html#functional/scatter_plot_label_font_size
Something weird is happening w/ the scatter plot labels. Unclear why the size "stutters" when increasing font size. Note that internally, we do not use scatter plot labels.
2021-10-11 21 27 59

Category axis

http://localhost:9999/quicktests/dev/index.html#functional/category_axis_label_font_size
2021-10-11 21 27 52

Numeric axis

http://localhost:9999/quicktests/dev/index.html#functional/numeric_axis_label_font_size
2021-10-11 21 27 36

Time axis

http://localhost:9999/quicktests/dev/index.html#functional/time_axis_label_font_size
2021-10-11 21 27 23

@blueprint-bot

This comment has been minimized.

@blueprint-bot

This comment has been minimized.

src/plots/stackedBarPlot.ts Outdated Show resolved Hide resolved
src/plots/barPlot.ts Outdated Show resolved Hide resolved
@blueprint-bot

This comment has been minimized.

@blueprint-bot

This comment has been minimized.

@michael-yx-wu michael-yx-wu marked this pull request as ready for review October 12, 2021 02:03
@blueprint-bot
Copy link

Clean up jsdoc

Demo: quicktests | fiddle

Copy link

@Nifdee Nifdee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, seems to work fine.

plottable.css Outdated Show resolved Hide resolved
src/axes/axis.ts Outdated Show resolved Hide resolved
@blueprint-bot
Copy link

Address nits

Demo: quicktests | fiddle

@michael-yx-wu michael-yx-wu merged commit 2333f4e into develop Oct 18, 2021
@michael-yx-wu michael-yx-wu changed the title Support custom font sizes for some plots Support custom font sizes Oct 18, 2021
@michael-yx-wu michael-yx-wu deleted the mw/custom-font-sizes branch October 18, 2021 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants