@mui/x-charts
Version:
The community edition of MUI X Charts components.
60 lines • 1.53 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["processedSeries", "className", "skipAnimation"];
import * as React from 'react';
import { BarLabelItem } from "./BarLabelItem.js";
import { jsx as _jsx } from "react/jsx-runtime";
/**
* @ignore - internal component.
*/
function BarLabelPlot(props) {
const {
processedSeries,
className,
skipAnimation
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
seriesId,
data,
layout,
xOrigin,
yOrigin
} = processedSeries;
const barLabel = processedSeries.barLabel ?? props.barLabel;
if (!barLabel) {
return null;
}
return /*#__PURE__*/_jsx("g", {
className: className,
"data-series": seriesId,
children: data.map(({
x,
y,
dataIndex,
color,
value,
width,
height,
hidden
}) => /*#__PURE__*/_jsx(BarLabelItem, _extends({
seriesId: seriesId,
dataIndex: dataIndex,
value: value,
color: color,
xOrigin: xOrigin,
yOrigin: yOrigin,
x: x,
y: y,
width: width,
height: height,
skipAnimation: skipAnimation ?? false,
layout: layout ?? 'vertical',
hidden: hidden
}, other, {
barLabel: barLabel,
barLabelPlacement: processedSeries.barLabelPlacement || 'center'
}), dataIndex))
}, seriesId);
}
export { BarLabelPlot };