Skip to content

Handle font sizes that are set as strings#6921

Merged
etimberg merged 1 commit intochartjs:masterfrom
etimberg:support-string-font-size
Jan 6, 2020
Merged

Handle font sizes that are set as strings#6921
etimberg merged 1 commit intochartjs:masterfrom
etimberg:support-string-font-size

Conversation

@etimberg
Copy link
Copy Markdown
Member

@etimberg etimberg commented Jan 5, 2020

Resolves #6373

@benmccann
Copy link
Copy Markdown
Contributor

Hmm, that issue is saying that there's an inconsistency between the legend and title fontSize where legend accepts a string and title doesn't. From a glance at the code, I don't see where legend accepts a string, so we might want to make sure that it still does and we're not introducing an inconsistency here. But if it does, I'd probably go the other direction and make legend fontSize only accept number. I'm not sure I want to find every option that takes a number and make sure they all work with string

@etimberg
Copy link
Copy Markdown
Member Author

etimberg commented Jan 5, 2020

I don't think either accept a string before this PR. They may have previously done so, but _parseFont couldn't handle it so if the title supported a string it was broken before. Since all font parsing is done with _parseFont, I think any font size could now be a string

@etimberg
Copy link
Copy Markdown
Member Author

etimberg commented Jan 5, 2020

In terms of accepting or rejecting invalid parameters, I'm not sure what options we have. We'd need some kind of pass to reject these and spit out useful error messages.

@etimberg etimberg requested a review from kurkle January 6, 2020 12:23
@etimberg etimberg merged commit ac85ce4 into chartjs:master Jan 6, 2020
@etimberg etimberg deleted the support-string-font-size branch January 19, 2020 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legend-Labels fontSize does not work when receiving String number

3 participants