Feature: Function wrapper for the standalone ECharts provider configuration
fireflysemantics opened this issue · 0 comments
fireflysemantics commented
It would be nice if ngx-echarts
had a function wrapper like this that we could call. It's symmetric with respect to the Angular provided APIs. So we could bootstrap the application like this:
bootstrapApplication(AppComponent, {
providers: [
provideRouter(routes),
provideAnimations(),
provideHttpClient(),
provideECharts(),
...
],
});
/**
* Function wrapper for initializing
* the ngx echarts provider.
*
* @returns The provider for ngx-echarts
*/
export function provideECharts(): Provider {
const echartsProvider = {
provide: NGX_ECHARTS_CONFIG,
useFactory: () => ({ echarts: () => import('echarts') }),
};
return echartsProvider;
}
Also an interface
for the initOpts
object would be nice. Something like:
/**
* Interface for the ECharts initOpts
* @example
*
* initOpts = {
* renderer: 'svg',
* width: 400,
* height: 600,
* };
*/
export interface NgxEChartsInitOpts {
renderer?: string;
width?: number;
height?: number;
}