-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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 support for gridLines/angleLines borderDash for polarArea/radar charts #5850
Conversation
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.
It looks really good, thank you @nagix
A few questions about the API:
- are we sure that
borderDash*
are part of the global defaults (can't find code / doc)? - if so, should we fallback to these global values by "default" (meaning that
angleLines.borderDash*
should beundefined
anddefaults.global.borderDash*
have values)? - should we also fallback to the
gridLines
values? (ie.angleLines.borderDash* else gridLines.borderDash* else globalDefaults.borderDash*
)
I just copied code from core.scale.js, but as you say, there's no Why don't we introduce the global defaults for scale options like I can open a new PR for this while removing |
Looking how element options are resolved, they don't fallback to borderDash = gridLines.borderDash || [];
borderDashOffset = gridLines.borderDashOffset || 0; and resolve borderDash = helpers.valueOrDefault(angleLineOpts.borderDash, gridLineOpts.borderDash) || [];
borderDashOffset = helpers.valueOrDefault(angleLineOpts.borderDashOffset, gridLineOpts.borderDashOffset) || 0; I don't know if removing |
@simonbrunel I didn't notice that as |
a002da9
to
b2f7e13
Compare
I agree, it should be better documented (the whole scale documentation would need a refresh actually). I also agree that breaking cases are very unlikely. |
As I have added checks for |
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.
Thanks @nagix
@etimberg can you please review this one and give your thought about considering a color or width option with undefined
or null
final value (i.e. after options are merged) as "none". In the context of this PR, that means if (grid|angle)Lines.color
and/or (grid|angle)Lines.lineWidth
are undefined
or null
, we skip drawing grid/angle lines instead of drawing with the current context values (see this comment).
I'm ok with |
How can I add this feature to my Chart.js file ? |
See the documentation changes in this PR for info on how to use the feature. It is not yet available however. It will be part of Chart.js 2.8.0 which is not released yet. Hopefully it will be in the next couple weeks. We are working on getting it ready for release now |
This PR adds support for gridLines/angleLines
borderDash
andborderDashOffset
options for polarArea and radar charts.See https://jsfiddle.net/nagix/9nL5qcuy/.
Fixes #4976