ng2-charts icon indicating copy to clipboard operation
ng2-charts copied to clipboard

ChartOptions plugins

Open devna13 opened this issue 5 years ago • 3 comments

I'm trying to use this plugin with 'ng2-charts' https://nagix.github.io/chartjs-plugin-colorschemes/ but I can't find any example on this, what's the right way to do this ?

  options: ChartOptions = {
    plugins: {
      pluginId: 'chartjs-plugin-colorschemes'
    }
  };

Also tried this but it didn't work

Chart.defaults.global.plugins.colorschemes.scheme = 'brewer.RdPu4';

Thanks

devna13 avatar Apr 23 '19 16:04 devna13

Same here.. I got same problems.. Anyone have Idea about this ?

plugins: {
                colorschemes: {
                    scheme: 'brewer.YlGn4'
                }
            },

efriandika avatar May 06 '19 08:05 efriandika

There is an example here: https://valor-software.com/ng2-charts/#/LineChart

ts:

import * as chartDownsamplePlugin from 'chartjs-plugin-downsample';

export class MyComponent {
    chartPlugins = [chartDownsamplePlugin];
}

template:

<canvas baseChart
              [data]="chartData"
              [options]="chartOptions"
              [plugins]="chartPlugins"
              chartType="line"
      >
      </canvas>

MickL avatar Apr 11 '20 18:04 MickL

I had similar issue too just now. You have to override the colors by setting override: true in the plugin settings:

plugins: {
    colorschemes: {
        scheme: 'brewer.YlGn4',
+       override: true
    }
},

AlexAtHome avatar Jul 17 '20 09:07 AlexAtHome

Shown in LineChart how to use a plugin that requires registration.

santam85 avatar Mar 01 '24 16:03 santam85