UNPKG

@totalsoft/rocket-ui

Version:

A set of reusable and composable React components built on top of Material UI core for developing fast and friendly web applications interfaces.

24 lines 1.08 kB
import React from 'react'; import { BarChart, Gauge, LineChart, PieChart, ScatterChart } from '@mui/x-charts'; /** * The Chart component serves as a unified interface for rendering all available chart types in MUI X, * providing flexibility and simplicity in chart selection. */ const Chart = ({ type, ...props }) => { switch (type) { case 'line': return React.createElement(LineChart, { "data-testid": "line-chart", ...props }); case 'bar': return React.createElement(BarChart, { "data-testid": "bar-chart", ...props }); case 'pie': return React.createElement(PieChart, { "data-testid": "pie-chart", ...props }); case 'scatter': return React.createElement(ScatterChart, { "data-testid": "scatter-chart", ...props }); case 'gauge': return React.createElement(Gauge, { "data-testid": "gauge-chart", ...props }); default: return React.createElement("p", null, "Unsupported chart type"); } }; export default Chart; //# sourceMappingURL=Chart.js.map