diff --git a/sandboxes/bubble/default/App.tsx b/sandboxes/bubble/default/App.tsx new file mode 100644 index 000000000..f9087c4c1 --- /dev/null +++ b/sandboxes/bubble/default/App.tsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { Bubble } from 'react-chartjs-2'; +import faker from 'faker'; + +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 ; +} diff --git a/sandboxes/bubble/default/index.tsx b/sandboxes/bubble/default/index.tsx new file mode 100644 index 000000000..4a75b54d0 --- /dev/null +++ b/sandboxes/bubble/default/index.tsx @@ -0,0 +1,7 @@ +import React from 'react'; +import { render } from 'react-dom'; + +import { App } from './App'; + +const rootElement = document.getElementById('root'); +render(, rootElement); diff --git a/sandboxes/bubble/default/package.json b/sandboxes/bubble/default/package.json new file mode 100644 index 000000000..33d590fe8 --- /dev/null +++ b/sandboxes/bubble/default/package.json @@ -0,0 +1,16 @@ +{ + "main": "index.tsx", + "dependencies": { + "chart.js": "^3.6.0", + "faker": "5.5.3", + "react": "17.0.2", + "react-chartjs-2": "^3.3.0", + "react-dom": "17.0.2", + "react-scripts": "4.0.3" + }, + "devDependencies": { + "@types/react": "17.0.20", + "@types/react-dom": "17.0.9", + "typescript": "4.4.2" + } +} diff --git a/stories/Bubble.tsx b/stories/Bubble.tsx new file mode 100644 index 000000000..d90037575 --- /dev/null +++ b/stories/Bubble.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { Bubble } from '../src'; +import { data, options } from '../sandboxes/bubble/default/App'; + +export default { + title: 'Components/Bubble', + component: Bubble, + parameters: { + layout: 'centered', + }, + args: { + width: 500, + height: 400, + }, +}; + +export const Default = args => ; + +Default.args = { + data, + options, +};