UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

42 lines 1.1 kB
import { type SeriesId } from "../../models/seriesType/common.js"; import type { BarLabelClasses } from "./barLabelClasses.js"; import { type BarValueType } from "../../models/index.js"; export interface BarLabelOwnerState { seriesId: SeriesId; dataIndex: number; color: string; isFaded: boolean; isHighlighted: boolean; skipAnimation: boolean; layout: 'vertical' | 'horizontal'; classes?: Partial<BarLabelClasses>; } export type BarItem = { /** * The series id of the bar. */ seriesId: SeriesId; /** * The index of the data point in the series. */ dataIndex: number; /** * The value of the data point. */ value: BarValueType | null; }; export type BarLabelContext = { bar: { /** * The height of the bar. * It could be used to control the label based on the bar size. */ height: number; /** * The width of the bar. * It could be used to control the label based on the bar size. */ width: number; }; }; export type BarLabelFunction = (item: BarItem, context: BarLabelContext) => string | null | undefined;