Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda