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! |
| 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.
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.
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.
@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.layoutServicetoChart.layoutand make it importable.Relates to #4478