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

116
Vistas
Use multiple datasets with Javascript Chart

I am trying to add a dataset to my Chart in order to compare values. I already have the red one and I want to add the blue one as you can see on this picture : Chart

The problem I have is that as you can see on the picture, the blue line is way higher than the red one but if we watch the values, the blue line should be bellow the red line... Does anybody know why my blue line is that way ?

Here is my code :

datasets: [{
                backgroundColor: window.chartColors.red,
                borderColor: window.chartColors.red,
                data: [
                    {% if history|length > 0 %}
                    {{ history['values']|join(',') }}
                    {% endif %}
                ],
                fill: false,
            },
            {
                backgroundColor: window.chartColors.blue,
                borderColor: window.chartColors.blue,
                data: [
                    {% if history|length > 0 %}
                    {{ history['valuesSecteur']|join(',') }}
                    {% endif %}
                ],
                fill: false,
            }]

EDIT I also wanted to add that the data for the blue line is 8 times the value 2.5 so I don't understand why the line is not straight. It is actually copying the red line...

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Okay I managed to fix it !

It was in the Chart options in 'scales'.

options: {
            scales: {
                xAxes: [{
                    ...
                }],
                yAxes: [{
                    ...
                    },
                    stacked: false,
                    ticks: {
                        ...
                    }
                }]
            }
        }

stacked was set to true and that's why it was broken. It should be at false.

about 4 years ago · Juan Pablo Isaza 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