Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

462
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda