Search code examples
angularangular12ngx-charts

Angular Type '{ domain: string[]; }' is not assignable to type 'string | Color'


I am using ngx-charts with Angular 12 and I'm getting this error message then I use this:

colorScheme = {
  domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
};

The error message is:

Type '{ domain: string[]; }' is not assignable to type 'string | Color'.

How can I fix this?


Solution

  • Use the ngx-charts version 18 or below.

    The scheme type [scheme]="colorScheme", is asking for a string but the type you are providing is an object.

    The latest version 19 or above as scheme type is of string | color.