Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

457
Views
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?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report

0

ngx-charts version 19 or above accepts only types string or Color (from here), and to expand on another answer:

  • String examples include "cool", "natural", "vivid", etc from the preset color schemes in this file.
  • Color example to set your own custom scheme:
import { Color, ScaleType } from '@swimlane/ngx-charts';
export class foo {
  colorScheme: Color = {
    name: 'myScheme',
    selectable: true,
    group: ScaleType.Ordinal,
    domain: ['#f00', '#0f0', '#0ff'],
  };
}
<ngx-charts-area-chart 
 ...
 [scheme]="colorScheme"
></ngx-charts-area-chart>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!