Skip to content
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

Feature: Function wrapper for the standalone ECharts provider configuration #401

Open
fireflysemantics opened this issue Jun 14, 2023 · 0 comments

Comments

@fireflysemantics
Copy link

fireflysemantics commented Jun 14, 2023

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant