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

127
Views
react-chartjs-2 Line graph doesnt update with data

So I have a class LineChart.js which contains this code:

import React from 'react'
import {Line} from 'react-chartjs-2';


const data = {
    labels: ['red'],
    datasets: [{
      label: 'My First Dataset',
      data: [65],
      fill: false,
      borderColor: 'rgb(75, 192, 192)',
      tension: 0.1
    }]
  };

function LineChart() {
   
    return (

        <div>

            <h3>Hello</h3>

            <Line> 
                data = {data}
            </Line>

        </div>

    )
}

export default LineChart

I call this in another class by using:

    <div className={classes.chartContainer}>
                <LineChart></LineChart>
                </div> 

When I run this code it shows me a text "Hello" and under it is a default graph, but no data has been processed. See image: https://gyazo.com/312696275a57306c531d3872c75aa0d9

Does anybody know what i'm doing wrong? I'm seeing no weird error loggings.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I believe it should be like this:

<Line data={data}/>

Given this small description https://www.npmjs.com/package/react-chartjs-2

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!