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

120
Views
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 answers
Answer question

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 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!