-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathApp.tsx
More file actions
38 lines (34 loc) · 778 Bytes
/
App.tsx
File metadata and controls
38 lines (34 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import {
Chart as ChartJS,
LinearScale,
PointElement,
LineElement,
Tooltip,
Legend,
} from 'chart.js';
import { Scatter } from 'react-chartjs-2';
import { faker } from '@faker-js/faker';
ChartJS.register(LinearScale, PointElement, LineElement, Tooltip, Legend);
export const options = {
scales: {
y: {
beginAtZero: true,
},
},
};
export const data = {
datasets: [
{
label: 'A dataset',
data: Array.from({ length: 100 }, () => ({
x: faker.datatype.number({ min: -100, max: 100 }),
y: faker.datatype.number({ min: -100, max: 100 }),
})),
backgroundColor: 'rgba(255, 99, 132, 1)',
},
],
};
export function App() {
return <Scatter options={options} data={data} />;
}