// Dashboard.js import React from 'react'; import { Bar, Line, Pie } from 'react-chartjs-2'; import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement } from 'chart.js'; // Register the required components for Chart.js ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement); const Dashboard = () => { // Data for Bar Chart const barData = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [ { label: 'Sales Data', data: [65, 59, 80, 81, 56, 55, 40], backgroundColor: 'rgba(75, 192, 192, 0.6)', borderColor: 'rgba(75, 192, 192, 1)', borderWidth: 1, }, ], }; // Options for Bar Chart const barOptions = { responsive: true, plugins: { legend: { position: 'top', }, title: { display: true, text: 'Bar Chart Example', }, }, }; // Data for Line Chart const lineData = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [ { label: 'Revenue', data: [0, 20, 50, 70, 100, 130, 160], fill: false, borderColor: 'rgba(255, 99, 132, 1)', tension: 0.1, }, ], }; // Options for Line Chart const lineOptions = { responsive: true, plugins: { legend: { position: 'top', }, title: { display: true, text: 'Line Chart Example', }, }, }; // Data for Pie Chart const pieData = { labels: ['Red', 'Blue', 'Yellow'], datasets: [ { label: 'Colors', data: [300, 50, 100], backgroundColor: ['rgba(255, 99, 132, 0.6)', 'rgba(54, 162, 235, 0.6)', 'rgba(255, 206, 86, 0.6)'], borderColor: ['rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)'], borderWidth: 1, }, ], }; // Options for Pie Chart const pieOptions = { responsive: true, plugins: { legend: { position: 'top', }, title: { display: true, text: 'Pie Chart Example', }, }, }; return (
); }; export default Dashboard;