Get started with react-chartjs CDN

MIT licensed

React-ChartJS: Library for interactive Chart.js charts in React apps.

Tags:
  • react
  • react-component
  • chart
  • charts
  • graph
  • chartjs

Stable version

Copied!

How to start using react-chartjs CDN


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

const Chart = () => {
  const data = {
    labels: ['January', 'February', 'March', 'April', 'May'],
    datasets: [
      {
        label: 'Number of Visitors',
        data: [12, 19, 3, 5, 2],
        backgroundColor: 'rgba(255, 99, 122, 0.2)',
        borderColor: 'rgba(255, 99, 122, 1)',
        borderWidth: 1,
      },
    ],
  };

  const options = {
    scales: {
      y: {
        beginAtZero: true,
      },
    },
  };

  return <Line data={data} options={options} />;
};

export default Chart;
Copied!
Copied!

All versions