138 lines
5.0 KiB
JavaScript
138 lines
5.0 KiB
JavaScript
"use strict";
|
|
'use client';
|
|
|
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.ChartsYAxis = ChartsYAxis;
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
var React = _interopRequireWildcard(require("react"));
|
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
var _warning = require("@mui/x-internals/warning");
|
|
var _hooks = require("../hooks");
|
|
var _ChartsYAxisImpl = require("./ChartsYAxisImpl");
|
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
/**
|
|
* Demos:
|
|
*
|
|
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
*
|
|
* API:
|
|
*
|
|
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
|
|
*/function ChartsYAxis(inProps) {
|
|
const {
|
|
yAxis,
|
|
yAxisIds
|
|
} = (0, _hooks.useYAxes)();
|
|
const axis = yAxis[inProps.axisId ?? yAxisIds[0]];
|
|
if (!axis) {
|
|
(0, _warning.warnOnce)(`MUI X Charts: No axis found. The axisId "${inProps.axisId}" is probably invalid.`);
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsYAxisImpl.ChartsYAxisImpl, (0, _extends2.default)({}, inProps, {
|
|
axis: axis
|
|
}));
|
|
}
|
|
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.default.oneOf(['y']),
|
|
/**
|
|
* The id of the axis to render.
|
|
* If undefined, it will be the first defined axis.
|
|
*/
|
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
/**
|
|
* Override or extend the styles applied to the component.
|
|
*/
|
|
classes: _propTypes.default.object,
|
|
/**
|
|
* If true, the axis line is disabled.
|
|
* @default false
|
|
*/
|
|
disableLine: _propTypes.default.bool,
|
|
/**
|
|
* If true, the ticks are disabled.
|
|
* @default false
|
|
*/
|
|
disableTicks: _propTypes.default.bool,
|
|
/**
|
|
* The label of the axis.
|
|
*/
|
|
label: _propTypes.default.string,
|
|
/**
|
|
* The style applied to the axis label.
|
|
*/
|
|
labelStyle: _propTypes.default.object,
|
|
/**
|
|
* The props used for each component slot.
|
|
* @default {}
|
|
*/
|
|
slotProps: _propTypes.default.object,
|
|
/**
|
|
* Overridable component slots.
|
|
* @default {}
|
|
*/
|
|
slots: _propTypes.default.object,
|
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.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.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.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.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.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.default.oneOf(['middle', 'tick']),
|
|
/**
|
|
* The style applied to ticks text.
|
|
*/
|
|
tickLabelStyle: _propTypes.default.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.default.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.default.number,
|
|
/**
|
|
* The number of ticks. This number is not guaranteed.
|
|
* Not supported by categorical axis (band, points).
|
|
*/
|
|
tickNumber: _propTypes.default.number,
|
|
/**
|
|
* The placement of ticks in regard to the band interval.
|
|
* Only used if scale is 'band'.
|
|
* @default 'extremities'
|
|
*/
|
|
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
/**
|
|
* The size of the ticks.
|
|
* @default 6
|
|
*/
|
|
tickSize: _propTypes.default.number
|
|
} : void 0; |