Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add stroke lines option around ticks to improve readability #6787
Add stroke lines option around ticks to improve readability #6787
Changes from 2 commits
4b7e0f2
72a6e70
da952b3
91797dd
9a0d766
3fda161
de76d65
028102b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These options should probably be included in
parseFontOptions
insteadWe have a notion of major & minor ticks, which is best demonstrated here: https://www.chartjs.org/samples/latest/scales/time/financial.html. In that example we have the years as major ticks and have them formatted differently. Putting in
parseFontOptions
will allow the users to have different strokeStyle and lineWidth for major and minor ticks. While I don't have a specific use case in mind for that it would be more consistent with how the other options workThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think I'm missing something.
It is already in
parseFontOptions
, but if for example, I don't add it here or in_parseFont
, the arguments are not set, I meanstrokeStyle
andlineWidth
are empty... where is the "setter"? I don't find itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki! I let the
parseTickFontOptions
how it was and the new options are only inparseFontOptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
tickFont.strokeStyle
, I guess this is the missing link.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kurkle, thanks for the suggestion, but unfortunately nop:
I need to explicitly add it to
_parseFont
to have it available intickFont
, but it seems that I'm adding this new options to everywhere that needs to parse fonts, so it's like a little dirty, doesn't it?However, I can't find how to use the options directly inside
_drawLabels
, the new arguments are empty if I don't add in_parseFont
orparseTickFontOptions
.. so there is some magic somewhere that I can't findThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You had those changes in
parseFontOptions
when debugging?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it's there
lineWidth
,strokeStyle
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, the options are in
optionTicks
and as I commented above, I let also thepareFontOptions
for the minor and major.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be ok with enabling it in
_parseFont
if we allow all the text to be stroked as well (likely outside the scope of this PR)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think specifying different lineWidth for major ticks works now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my memory serves,
ctx
will not accept alineWidth
of0
and remains in the previous value.So I think we should add a check for
lineWidth
and not do thestrokeText
if its not defined.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good one, I did a small test and
ctx
does not accept zeros inlineWidth
at all. I added a small conditional. thanks!