@mui/x-charts
Version:
The community edition of MUI X Charts components.
39 lines • 1.44 kB
JavaScript
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
let cartesianInstance;
let polarInstance;
class CartesianSeriesTypes {
types = new Set();
constructor() {
if (cartesianInstance) {
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: Only one CartesianSeriesTypes instance can be created. ' + 'This is a singleton class used internally for series type registration. ' + 'Use the existing instance instead of creating a new one.' : _formatErrorMessage(24));
}
cartesianInstance = this.types;
}
addType(value) {
this.types.add(value);
}
getTypes() {
return this.types;
}
}
class PolarSeriesTypes {
types = new Set();
constructor() {
if (polarInstance) {
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: Only one PolarSeriesTypes instance can be created. ' + 'This is a singleton class used internally for series type registration. ' + 'Use the existing instance instead of creating a new one.' : _formatErrorMessage(25));
}
polarInstance = this.types;
}
addType(value) {
this.types.add(value);
}
getTypes() {
return this.types;
}
}
export const cartesianSeriesTypes = new CartesianSeriesTypes();
cartesianSeriesTypes.addType('bar');
cartesianSeriesTypes.addType('line');
cartesianSeriesTypes.addType('scatter');
export const polarSeriesTypes = new PolarSeriesTypes();
polarSeriesTypes.addType('radar');