source: node_modules/recharts/es6/cartesian/ZAxis.js@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 1.9 KB
Line 
1import * as React from 'react';
2import { useLayoutEffect, useRef } from 'react';
3import { addZAxis, removeZAxis, replaceZAxis } from '../state/cartesianAxisSlice';
4import { useAppDispatch } from '../state/hooks';
5import { implicitZAxis } from '../state/selectors/axisSelectors';
6import { resolveDefaultProps } from '../util/resolveDefaultProps';
7function SetZAxisSettings(settings) {
8 var dispatch = useAppDispatch();
9 var prevSettingsRef = useRef(null);
10 useLayoutEffect(() => {
11 if (prevSettingsRef.current === null) {
12 dispatch(addZAxis(settings));
13 } else if (prevSettingsRef.current !== settings) {
14 dispatch(replaceZAxis({
15 prev: prevSettingsRef.current,
16 next: settings
17 }));
18 }
19 prevSettingsRef.current = settings;
20 }, [settings, dispatch]);
21 useLayoutEffect(() => {
22 return () => {
23 if (prevSettingsRef.current) {
24 dispatch(removeZAxis(prevSettingsRef.current));
25 prevSettingsRef.current = null;
26 }
27 };
28 }, [dispatch]);
29 return null;
30}
31export var zAxisDefaultProps = {
32 zAxisId: 0,
33 range: implicitZAxis.range,
34 scale: implicitZAxis.scale,
35 type: implicitZAxis.type
36};
37
38/**
39 * Virtual axis, does not render anything itself. Has no ticks, grid lines, or labels.
40 * Useful for dynamically setting Scatter point size, based on data.
41 *
42 * @consumes CartesianViewBoxContext
43 */
44export function ZAxis(outsideProps) {
45 var props = resolveDefaultProps(outsideProps, zAxisDefaultProps);
46 return /*#__PURE__*/React.createElement(SetZAxisSettings, {
47 domain: props.domain,
48 id: props.zAxisId,
49 dataKey: props.dataKey,
50 name: props.name,
51 unit: props.unit,
52 range: props.range,
53 scale: props.scale,
54 type: props.type,
55 allowDuplicatedCategory: implicitZAxis.allowDuplicatedCategory,
56 allowDataOverflow: implicitZAxis.allowDataOverflow,
57 reversed: implicitZAxis.reversed,
58 includeHidden: implicitZAxis.includeHidden
59 });
60}
61ZAxis.displayName = 'ZAxis';
Note: See TracBrowser for help on using the repository browser.