UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

41 lines 1.03 kB
import { SeriesId } from "../../models/seriesType/common.js"; import type { BarLabelClasses } from "./barLabelClasses.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: number | 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;