-
Notifications
You must be signed in to change notification settings - Fork 32
Unify our module registries #5273
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
base: latest
Are you sure you want to change the base?
Conversation
this.isRollingBack = false; | ||
} | ||
|
||
private predictAxes(seriesType: SeriesType, userSeriesOptions?: any, data?: DatumDefault[]) { |
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.
Could we easily extract this to a utility function, this doesn't feel like the best place for this logic to live?
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.
Sure. I started by making it a standalone function, but this was the only part of the code that actually uses it, and I didn't want to breakdown the optionsGraph approach.
const { layoutBox } = ctx; | ||
|
||
const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule<any>('seriesArea').getPadding()); | ||
const seriesAreaModule = this.modulesManager.getModule('seriesArea') as any; |
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.
Are the as any
casts a temporary measure?
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.
In this specific case you can see that it was already case to any
in here: getModule<any>('seriesArea')
We can obviously improve on it, but not sure if it'll be in this iteration.
for (let index = 0; index < options.length; index++) { | ||
const axisOptions = options[index]; | ||
const axis = axisRegistry.create(axisOptions.type, moduleContext); | ||
const axis = ModuleRegistry.getAxisModule(axisOptions.type)!.create(moduleContext) as any; |
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.
Are the as any
casts a temporary measure?
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.
Yes, it's temporary, though we should probably find a better way to handle this.
private createSeries(seriesOptions: SeriesOptionsTypes): UnknownSeries { | ||
const seriesInstance = seriesRegistry.create(seriesOptions.type, this.getModuleContext()) as UnknownSeries; | ||
const seriesModule = ModuleRegistry.getSeriesModule(seriesOptions.type); | ||
const seriesInstance = seriesModule!.create(this.getModuleContext()) as UnknownSeries; |
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.
Do we need the !
here and below?
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.
Yes, because seriesModule
can also be undefined
.
We could change the logic to throw in such cases, to simplify the types, but it's a bigger change.
No description provided.