source: node_modules/recharts/lib/cartesian/ZAxis.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 2.9 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.ZAxis = ZAxis;
7exports.zAxisDefaultProps = void 0;
8var _react = _interopRequireWildcard(require("react"));
9var React = _react;
10var _cartesianAxisSlice = require("../state/cartesianAxisSlice");
11var _hooks = require("../state/hooks");
12var _axisSelectors = require("../state/selectors/axisSelectors");
13var _resolveDefaultProps = require("../util/resolveDefaultProps");
14function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15function SetZAxisSettings(settings) {
16 var dispatch = (0, _hooks.useAppDispatch)();
17 var prevSettingsRef = (0, _react.useRef)(null);
18 (0, _react.useLayoutEffect)(() => {
19 if (prevSettingsRef.current === null) {
20 dispatch((0, _cartesianAxisSlice.addZAxis)(settings));
21 } else if (prevSettingsRef.current !== settings) {
22 dispatch((0, _cartesianAxisSlice.replaceZAxis)({
23 prev: prevSettingsRef.current,
24 next: settings
25 }));
26 }
27 prevSettingsRef.current = settings;
28 }, [settings, dispatch]);
29 (0, _react.useLayoutEffect)(() => {
30 return () => {
31 if (prevSettingsRef.current) {
32 dispatch((0, _cartesianAxisSlice.removeZAxis)(prevSettingsRef.current));
33 prevSettingsRef.current = null;
34 }
35 };
36 }, [dispatch]);
37 return null;
38}
39var zAxisDefaultProps = exports.zAxisDefaultProps = {
40 zAxisId: 0,
41 range: _axisSelectors.implicitZAxis.range,
42 scale: _axisSelectors.implicitZAxis.scale,
43 type: _axisSelectors.implicitZAxis.type
44};
45
46/**
47 * Virtual axis, does not render anything itself. Has no ticks, grid lines, or labels.
48 * Useful for dynamically setting Scatter point size, based on data.
49 *
50 * @consumes CartesianViewBoxContext
51 */
52function ZAxis(outsideProps) {
53 var props = (0, _resolveDefaultProps.resolveDefaultProps)(outsideProps, zAxisDefaultProps);
54 return /*#__PURE__*/React.createElement(SetZAxisSettings, {
55 domain: props.domain,
56 id: props.zAxisId,
57 dataKey: props.dataKey,
58 name: props.name,
59 unit: props.unit,
60 range: props.range,
61 scale: props.scale,
62 type: props.type,
63 allowDuplicatedCategory: _axisSelectors.implicitZAxis.allowDuplicatedCategory,
64 allowDataOverflow: _axisSelectors.implicitZAxis.allowDataOverflow,
65 reversed: _axisSelectors.implicitZAxis.reversed,
66 includeHidden: _axisSelectors.implicitZAxis.includeHidden
67 });
68}
69ZAxis.displayName = 'ZAxis';
Note: See TracBrowser for help on using the repository browser.