keanacobarde / on-paper

Spend your money OnPaper first!
0 stars 0 forks source link

STRETCH - CHART.JS IMPLEMENTATION - OUTLOOK PAGE #46

Closed keanacobarde closed 9 months ago

keanacobarde commented 9 months ago

User Story

Acceptance Criteria

WIREFRAME

image

Dependecies

N / A - All data required for this exists within FireBase already. It's just getting around to using Chart.js in order to visualize the information.

Dev Notes

keanacobarde commented 9 months ago

Installation guide:

npm install chart.js react-chartjs-2

The first dependency will install chart.js itself, which can be used in vanilla JS. react-chartjs-2 is used as a React wrapper which will allow for an easier time with implementing chart.js within React.

keanacobarde commented 9 months ago

IMPORTS

import { Chart as ChartJS } from 'chart.js/auto';
import { Doughtnut } from 'react-chartjs-2';
keanacobarde commented 9 months ago

image

Taken from Chart.js documentation - a Vanilla JS setup. Find the React component.

const data = {
  labels: [
    'Red',
    'Blue',
    'Yellow'
  ],
  datasets: [{
    label: 'My First Dataset',
    data: [300, 50, 100],
    backgroundColor: [
      'rgb(255, 99, 132)',
      'rgb(54, 162, 235)',
      'rgb(255, 205, 86)'
    ],
    hoverOffset: 4
  }]
};
keanacobarde commented 9 months ago

CURRENT COURSE OF ACTION:

keanacobarde commented 9 months ago

IMPLEMENTATION COMPLETED WITHIN #50 - CLOSING TICKET