-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathApp.tsx
47 lines (43 loc) · 1.1 KB
/
App.tsx
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
39
40
41
42
43
44
45
46
47
import React from 'react';
import {
Chart as ChartJS,
LinearScale,
PointElement,
Tooltip,
Legend,
} from 'chart.js';
import { Bubble } from 'react-chartjs-2';
import { faker } from '@faker-js/faker';
ChartJS.register(LinearScale, PointElement, Tooltip, Legend);
export const options = {
scales: {
y: {
beginAtZero: true,
},
},
};
export const data = {
datasets: [
{
label: 'Red dataset',
data: Array.from({ length: 50 }, () => ({
x: faker.datatype.number({ min: -100, max: 100 }),
y: faker.datatype.number({ min: -100, max: 100 }),
r: faker.datatype.number({ min: 5, max: 20 }),
})),
backgroundColor: 'rgba(255, 99, 132, 0.5)',
},
{
label: 'Blue dataset',
data: Array.from({ length: 50 }, () => ({
x: faker.datatype.number({ min: -100, max: 100 }),
y: faker.datatype.number({ min: -100, max: 100 }),
r: faker.datatype.number({ min: 5, max: 20 }),
})),
backgroundColor: 'rgba(53, 162, 235, 0.5)',
},
],
};
export function App() {
return <Bubble options={options} data={data} />;
}