Skip to content
Advertisement

Using Charts.js with react

I am using React and want to tie it in with Chart.js.

The graph below works, but I am not sure how to make a Graph component in React.

My Chart.js code looks like the following:

JavaScript
JavaScript

I then tried to incorporate this into React. Unfortunately, this didn’t work.

My code attempt can be seen here.This is kind of working, but not really, and I have no idea what approach to take.

JavaScript

Advertisement

Answer

There is a React wrapper around ChartJS available from ReactJS organisation on GitHub. It does support bar charts. Maybe try this (if not as a solution, then as a source of inspiration)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement