Skip to content
Snippets Groups Projects
AssessmentDistributionChart.js 1.6 KiB
Newer Older
import {FakeData} from "../../utils/Data";
import {Chart, registerables} from 'chart.js';
import {Bar} from "react-chartjs-2";
function AssessmentDistributionChart() {
//TODO this is repeated code... need to make an actual grade distribution chart
    
    const chartData = {
        labels: FakeData.map((data) => data.grade),
        datasets: [{
            label: "Grade Distribution Dataset",
            data: FakeData.map((data) => data.count),
            //add customization options here
            backgroundColor: [
                "#ADD8E6",
                "#3CB371"
            ],
        }]
    };

    return (
        <div className="chart-container" style={{width: 40 + 'vw', padding: 50 + 'px'}}>
            <h2 style={{textAlign: "center"}}>Grade Distribution</h2>
            <Bar
                data={chartData}
                options={{
                    scales: {
                        y: {
                            title: {
                                display: true,
                                text: "Count",
                            },
                            beginAtZero: true
                        },
                        x: {
                            title: {
                                display: true,
                                text: "Grade",
                            },
                        }