@mui/x-charts
Version:
The community edition of MUI X Charts components.
55 lines • 1.67 kB
TypeScript
import { ChartsLabelMarkProps } from "../ChartsLabel/ChartsLabelMark.js";
import { PieItemId } from "../models/index.js";
import { SeriesId } from "../models/seriesType/common.js";
interface LegendItemContextBase {
/**
* The color used in the legend
*/
color: string;
/**
* The label displayed in the legend
*/
label: string;
}
export interface LegendItemParams extends Partial<Omit<SeriesLegendItemContext, 'type' | keyof LegendItemContextBase>>, Partial<Omit<PiecewiseColorLegendItemContext, 'type' | keyof LegendItemContextBase>>, LegendItemContextBase {
/**
* The identifier of the legend element.
* Used for internal purpose such as `key` props
*/
id: number | string;
markType: ChartsLabelMarkProps['type'];
}
export interface SeriesLegendItemContext extends LegendItemContextBase {
/**
* The type of the legend item
* - `series` is used for series legend item
* - `piecewiseColor` is used for piecewise color legend item
*/
type: 'series';
/**
* The identifier of the series
*/
seriesId: SeriesId;
/**
* The identifier of the pie item
*/
itemId?: PieItemId;
}
export interface PiecewiseColorLegendItemContext extends LegendItemContextBase {
/**
* The type of the legend item
* - `series` is used for series legend item
* - `piecewiseColor` is used for piecewise color legend item
*/
type: 'piecewiseColor';
/**
* The minimum value of the category
*/
minValue: number | Date | null;
/**
* The maximum value of the category
*/
maxValue: number | Date | null;
}
export type LegendItemContext = SeriesLegendItemContext | PiecewiseColorLegendItemContext;
export {};