-
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
Make Chart.layout(Service)
importable
#5113
Conversation
Rename (and deprecate) `Chart.layoutService` to `Chart.layout` and make it importable.
4b4caed
to
c4b95cf
Compare
Fixed a comment typo! |
@@ -12,14 +12,14 @@ Chart.defaults = require('./core/core.defaults'); | |||
Chart.Element = require('./core/core.element'); | |||
Chart.elements = require('./elements/index'); | |||
Chart.Interaction = require('./core/core.interaction'); | |||
Chart.layout = require('./core/core.layout'); |
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.
actually, I'm just wondering now, do we actually need a Chart.layout
variable? shouldn't folks just call require('./core/core.layout')
when they need the layout?
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.
The layout (singleton) can be accessed from external plugins/charts, in which case it's not possible to require './core/core.layout'
.
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.
@etimberg @benmccann Actually, I don't know why the layout is a singleton instead of an object attached to each chart and accessible via chartInstance.layout
. Maybe that something we will like to change in v3.
For the alias, I would suggest another name to be consistent with other "Service" singletons: Chart.layouts
(plural since it manages many layouts), as we have Chart.plugins
and soon Chart.animations
and Chart.scales
.
What do you think?
Rename (and deprecate) `Chart.layoutService` to `Chart.layout` and make it importable.
Rename (and deprecate)
Chart.layoutService
toChart.layout
and make it importable.Relates to #4478