@mui/x-charts
Version:
The community edition of MUI X Charts components.
131 lines (129 loc) • 4.39 kB
JavaScript
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import PropTypes from 'prop-types';
import { useYAxes } from "../hooks/useAxis.js";
import { ChartsSingleYAxis } from "./ChartsSingleYAxis.js";
import { ChartsGroupedYAxis } from "./ChartsGroupedYAxis.js";
/**
* Demos:
*
* - [Axis](https://mui.com/x/react-charts/axis/)
*
* API:
*
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
*/
import { jsx as _jsx } from "react/jsx-runtime";
function ChartsYAxis(inProps) {
const {
yAxis,
yAxisIds
} = useYAxes();
const axis = yAxis[inProps.axisId ?? yAxisIds[0]];
if ('groups' in axis && Array.isArray(axis.groups)) {
return /*#__PURE__*/_jsx(ChartsGroupedYAxis, _extends({}, inProps));
}
return /*#__PURE__*/_jsx(ChartsSingleYAxis, _extends({}, inProps));
}
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
axis: PropTypes.oneOf(['y']),
/**
* The id of the axis to render.
* If undefined, it will be the first defined axis.
*/
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* Override or extend the styles applied to the component.
*/
classes: PropTypes.object,
/**
* If true, the axis line is disabled.
* @default false
*/
disableLine: PropTypes.bool,
/**
* If true, the ticks are disabled.
* @default false
*/
disableTicks: PropTypes.bool,
/**
* The label of the axis.
*/
label: PropTypes.string,
/**
* The style applied to the axis label.
*/
labelStyle: PropTypes.object,
/**
* The props used for each component slot.
* @default {}
*/
slotProps: PropTypes.object,
/**
* Overridable component slots.
* @default {}
*/
slots: PropTypes.object,
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
/**
* Defines which ticks are displayed.
* Its value can be:
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has "point" scale.
* - an array containing the values where ticks should be displayed.
* @see See {@link https://mui.com/x/react-charts/axis/#fixed-tick-positions}
* @default 'auto'
*/
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
/**
* Defines which ticks get its label displayed. Its value can be:
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
* @default 'auto'
*/
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
/**
* The placement of ticks label. Can be the middle of the band, or the tick position.
* Only used if scale is 'band'.
* @default 'middle'
*/
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
/**
* The style applied to ticks text.
*/
tickLabelStyle: PropTypes.object,
/**
* Maximal step between two ticks.
* When using time data, the value is assumed to be in ms.
* Not supported by categorical axis (band, points).
*/
tickMaxStep: PropTypes.number,
/**
* Minimal step between two ticks.
* When using time data, the value is assumed to be in ms.
* Not supported by categorical axis (band, points).
*/
tickMinStep: PropTypes.number,
/**
* The number of ticks. This number is not guaranteed.
* Not supported by categorical axis (band, points).
*/
tickNumber: PropTypes.number,
/**
* The placement of ticks in regard to the band interval.
* Only used if scale is 'band'.
* @default 'extremities'
*/
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
/**
* The size of the ticks.
* @default 6
*/
tickSize: PropTypes.number
} : void 0;
export { ChartsYAxis };