PHP Classes

File: client/src/features/components/Chart.tsx

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   client/src/features/components/Chart.tsx   Download  
File: client/src/features/components/Chart.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Wallet API and Application
Application to manage a wallet by calling an API
Author: By
Last change:
Date: 2 years ago
Size: 1,234 bytes
 

Contents

Class file image Download
import React from 'react'; import {Chart as ChartJS, ArcElement, Tooltip, Legend} from 'chart.js'; import {Pie} from 'react-chartjs-2'; ChartJS.register(ArcElement, Tooltip, Legend); interface Props { approved: number | undefined, declined: number | undefined, pending: number | undefined, } export function Chart({declined, pending, approved}: Props) { const generateData = () => { return { labels: ['Declined', 'Pending', 'Approved'], datasets: [ { label: '# all transaction', data: [declined, pending, approved], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)' ], borderColor: [ 'rgba(255, 99, 132, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', ], borderWidth: 1, }, ], } } return (<div style={{maxWidth: '400px', margin: '35px auto'}}><Pie data={generateData()}/></div>); }