Ng2-charts: chartjs-funnel is not supported?

Created on 25 Feb 2019  路  5Comments  路  Source: valor-software/ng2-charts

chartjs-funnel is not supported?
(npm install chartjs-funnel --save)
Thanks

All 5 comments

You should be able to register the chartjs-funnel plugin and use it as documented.

Here's how to register a plugin:

Import Chart from chart.js at the top of your file, as well as the funnel plugin:

    import { BaseChartDirective } from 'ng2-charts';
    import * as funnelPlugin from 'chartjs-funnel';

Then in your constructor (or other initialization function), register the plugin:

    BaseChartDirective.registerPlugin(funnelPlugin);

@paviad the way you described above will register plugin for every chart in the component. It does not work well with "chartjs-plugin-datalabels" where you only want a specific chart has the label.

There is a property on the chart directive called plugins in which you can pass a set of plugins to be used only for that chart and not globally. See this line at the demo app

public lineChartPlugins = [pluginAnnotations]

In the case of chartjs-plugin-datalabels it registers itself automatically globally, so you have to unregister it specifically at startup, for example, like this:

export class AppModule {
  constructor() {
    BaseChartDirective.unregisterPlugin(pluginDataLabels);
  }
}

@paviad it work. thanks : )

You should be able to register the chartjs-funnel plugin and use it as documented.

Here's how to register a plugin:

Import Chart from chart.js at the top of your file, as well as the funnel plugin:

    import { BaseChartDirective } from 'ng2-charts';
    import * as funnelPlugin from 'chartjs-funnel';

Then in your constructor (or other initialization function), register the plugin:

    BaseChartDirective.registerPlugin(funnelPlugin);

Hi, Could you show me the documentation, I cannot find any more about ng-charts with funnelPugin

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dslima90 picture dslima90  路  3Comments

dj-techs picture dj-techs  路  3Comments

alexcastillo picture alexcastillo  路  5Comments

grahammutter picture grahammutter  路  4Comments

shenriksen4 picture shenriksen4  路  3Comments