Skip to content

drnoir/switchingcharts-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create a Chart with multiple Dataset switching via state React + react-chartjs - DEMO Code

This tutorial goes over a basic overview of a method to create a chart in a class component in react using react-chartjs-2 and how to update the chart with different data using SetState within that chart based on onClick events within the component - in this example 3 months, 6 months and a year.

In a real life example you would probably get your data from props, or state but this should provide a good starting point for understanding how to do this.

Everything is standard create react app apart from BarChart.js

Example of class componenent with dataset switching

  • BarChart.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published