@octanejs/recharts 0.1.62 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/animation/AnimatedItems.tsrx +36 -31
- package/src/animation/CSSTransitionAnimate.tsrx +1 -2
- package/src/animation/JavascriptAnimate.tsrx +1 -2
- package/src/cartesian/Area.tsrx +414 -386
- package/src/cartesian/AreaRevealShape.tsrx +103 -84
- package/src/cartesian/Bar.tsrx +343 -317
- package/src/cartesian/BarStack.tsrx +33 -28
- package/src/cartesian/CartesianAxis.tsrx +168 -165
- package/src/cartesian/CartesianGrid.tsrx +256 -272
- package/src/cartesian/ErrorBar.tsrx +108 -104
- package/src/cartesian/Funnel.tsrx +405 -382
- package/src/cartesian/GraphicalItemClipPath.tsrx +4 -8
- package/src/cartesian/Line.tsrx +190 -177
- package/src/cartesian/LineDrawShape.tsrx +14 -15
- package/src/cartesian/ReferenceLine.tsrx +119 -105
- package/src/cartesian/Scatter.tsrx +416 -398
- package/src/cartesian/XAxis.tsrx +39 -32
- package/src/cartesian/YAxis.tsrx +47 -37
- package/src/cartesian/ZAxis.tsrx +76 -73
- package/src/chart/AreaChart.tsrx +15 -11
- package/src/chart/BarChart.tsrx +15 -11
- package/src/chart/CategoricalChart.tsrx +32 -26
- package/src/chart/ComposedChart.tsrx +15 -11
- package/src/chart/FunnelChart.tsrx +15 -11
- package/src/chart/LineChart.tsrx +15 -11
- package/src/chart/PieChart.tsrx +15 -11
- package/src/chart/PolarChart.tsrx +45 -48
- package/src/chart/RadarChart.tsrx +38 -32
- package/src/chart/RadialBarChart.tsrx +15 -11
- package/src/chart/RechartsWrapper.tsrx +214 -162
- package/src/chart/Sankey.tsrx +412 -378
- package/src/chart/ScatterChart.tsrx +15 -11
- package/src/chart/SunburstChart.tsrx +162 -155
- package/src/component/ActivePoints.tsrx +19 -13
- package/src/component/Cursor.tsrx +25 -18
- package/src/component/DefaultLegendContent.tsrx +131 -127
- package/src/component/DefaultTooltipContent.tsrx +46 -42
- package/src/component/Dots.tsrx +11 -5
- package/src/component/Label.tsrx +69 -55
- package/src/component/LabelList.tsrx +32 -27
- package/src/component/Legend.tsrx +120 -123
- package/src/component/ResponsiveContainer.tsrx +18 -11
- package/src/component/Text.tsrx +50 -43
- package/src/component/Tooltip.tsrx +234 -223
- package/src/component/TooltipBoundingBox.tsrx +34 -34
- package/src/container/ClipPathProvider.tsrx +1 -3
- package/src/container/Layer.tsrx +5 -1
- package/src/container/RootSurface.tsrx +31 -21
- package/src/container/Surface.tsrx +15 -13
- package/src/context/ErrorBarContext.tsrx +5 -5
- package/src/polar/Pie.tsrx +541 -487
- package/src/polar/PolarAngleAxis.tsrx +245 -227
- package/src/polar/PolarGrid.tsrx +139 -127
- package/src/polar/PolarRadiusAxis.tsrx +204 -185
- package/src/polar/Radar.tsrx +274 -264
- package/src/polar/RadialBar.tsrx +408 -361
- package/src/shape/Cross.tsrx +13 -7
- package/src/shape/Curve.tsrx +54 -44
- package/src/shape/Dot.tsrx +10 -8
- package/src/shape/Polygon.tsrx +38 -29
- package/src/shape/Rectangle.tsrx +73 -28
- package/src/shape/Sector.tsrx +30 -18
- package/src/shape/Symbols.tsrx +13 -11
- package/src/shape/Trapezoid.tsrx +16 -11
- package/src/state/RechartsStoreProvider.tsrx +5 -1
- package/src/synchronisation/useChartSynchronisation.tsrx +8 -7
- package/src/util/BarUtils.tsrx +43 -40
- package/src/util/FunnelUtils.tsrx +5 -5
- package/src/util/RadialBarUtils.tsrx +3 -4
- package/src/util/ScatterUtils.tsrx +13 -8
- package/src/zIndex/ZIndexLayer.tsrx +2 -2
- package/src/zIndex/ZIndexPortal.tsrx +2 -8
|
@@ -44,8 +44,7 @@ function resolveTransitionProperty(args: {
|
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
46
|
if (args.isAnimationActive && args.active) {
|
|
47
|
-
const easing =
|
|
48
|
-
typeof args.animationEasing === 'string' ? args.animationEasing : 'ease';
|
|
47
|
+
const easing = typeof args.animationEasing === 'string' ? args.animationEasing : 'ease';
|
|
49
48
|
return `transform ${args.animationDuration}ms ${easing}`;
|
|
50
49
|
}
|
|
51
50
|
return undefined;
|
|
@@ -53,12 +52,10 @@ function resolveTransitionProperty(args: {
|
|
|
53
52
|
|
|
54
53
|
function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
|
|
55
54
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
56
|
-
const [state, setState] = React.useState(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
55
|
+
const [state, setState] = React.useState(() => ({
|
|
56
|
+
dismissed: false,
|
|
57
|
+
dismissedAtCoordinate: { x: 0, y: 0 },
|
|
58
|
+
}));
|
|
62
59
|
|
|
63
60
|
React.useEffect(() => {
|
|
64
61
|
const handleKeyDown = (event: KeyboardEvent) => {
|
|
@@ -80,8 +77,8 @@ function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
|
|
|
80
77
|
|
|
81
78
|
if (
|
|
82
79
|
state.dismissed &&
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
((props.coordinate?.x ?? 0) !== state.dismissedAtCoordinate.x ||
|
|
81
|
+
(props.coordinate?.y ?? 0) !== state.dismissedAtCoordinate.y)
|
|
85
82
|
) {
|
|
86
83
|
setState({ ...state, dismissed: false });
|
|
87
84
|
}
|
|
@@ -100,35 +97,38 @@ function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
|
|
|
100
97
|
useTranslate3d: props.useTranslate3d,
|
|
101
98
|
viewBox: props.viewBox,
|
|
102
99
|
});
|
|
103
|
-
const positionStyle: CSSProperties =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
100
|
+
const positionStyle: CSSProperties = props.hasPortalFromProps
|
|
101
|
+
? {}
|
|
102
|
+
: {
|
|
103
|
+
transition: resolveTransitionProperty({
|
|
104
|
+
prefersReducedMotion,
|
|
105
|
+
isAnimationActive: props.isAnimationActive,
|
|
106
|
+
active: props.active,
|
|
107
|
+
animationDuration: props.animationDuration,
|
|
108
|
+
animationEasing: props.animationEasing,
|
|
109
|
+
}),
|
|
110
|
+
...cssProperties,
|
|
111
|
+
pointerEvents: 'none',
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: 0,
|
|
114
|
+
left: 0,
|
|
115
|
+
};
|
|
120
116
|
const outerStyle: CSSProperties = {
|
|
121
117
|
...positionStyle,
|
|
122
118
|
visibility: !state.dismissed && props.active && props.hasPayload ? 'visible' : 'hidden',
|
|
123
119
|
...props.wrapperStyle,
|
|
124
120
|
};
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
return (
|
|
122
|
+
<div
|
|
123
|
+
xmlns="http://www.w3.org/1999/xhtml"
|
|
124
|
+
tabIndex={-1}
|
|
125
|
+
className={cssClasses}
|
|
126
|
+
style={outerStyle}
|
|
127
|
+
ref={props.innerRef}
|
|
128
|
+
>
|
|
129
|
+
{props.children}
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export const TooltipBoundingBox = React.memo(TooltipBoundingBoxImpl);
|
|
@@ -8,9 +8,7 @@ import { usePlotArea } from '../hooks';
|
|
|
8
8
|
|
|
9
9
|
const ClipPathIdContext = createContext<string | undefined>(undefined);
|
|
10
10
|
|
|
11
|
-
export function ClipPathProvider(props: {
|
|
12
|
-
children: OctaneNode;
|
|
13
|
-
}) @{
|
|
11
|
+
export function ClipPathProvider(props: { children: OctaneNode }) @{
|
|
14
12
|
const { children } = props;
|
|
15
13
|
const [clipPathId] = useState(uniqueId('recharts') + '-clip');
|
|
16
14
|
const plotArea = usePlotArea();
|
package/src/container/Layer.tsrx
CHANGED
|
@@ -12,5 +12,9 @@ import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents.ts';
|
|
|
12
12
|
export function Layer(props: Props) {
|
|
13
13
|
const { children, className, ref, ...others } = props;
|
|
14
14
|
const layerClass = clsx('recharts-layer', className);
|
|
15
|
-
return
|
|
15
|
+
return (
|
|
16
|
+
<g className={layerClass} {...svgPropertiesAndEvents(others)} ref={ref}>
|
|
17
|
+
{children}
|
|
18
|
+
</g>
|
|
19
|
+
);
|
|
16
20
|
}
|
|
@@ -48,40 +48,50 @@ function MainChartSurface(props: RootSurfaceProps) {
|
|
|
48
48
|
role = hasAccessibilityLayer ? 'application' : undefined;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
return (
|
|
52
|
+
<Surface
|
|
53
|
+
{...otherAttributes}
|
|
54
|
+
title={title}
|
|
55
|
+
desc={desc}
|
|
56
|
+
role={role}
|
|
57
|
+
tabIndex={tabIndex}
|
|
58
|
+
width={width}
|
|
59
|
+
height={height}
|
|
60
|
+
style={FULL_WIDTH_AND_HEIGHT}
|
|
61
|
+
ref={ref}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</Surface>
|
|
65
|
+
);
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
function BrushPanoramaSurface(props: {
|
|
65
|
-
children: OctaneNode;
|
|
66
|
-
}) {
|
|
68
|
+
function BrushPanoramaSurface(props: { children: OctaneNode }) {
|
|
67
69
|
const { children } = props;
|
|
68
70
|
const brushDimensions = useAppSelector(selectBrushDimensions);
|
|
69
71
|
if (!brushDimensions) {
|
|
70
72
|
return null;
|
|
71
73
|
}
|
|
72
74
|
const { width, height, y, x } = brushDimensions;
|
|
73
|
-
return
|
|
75
|
+
return (
|
|
76
|
+
<Surface width={width} height={height} x={x} y={y}>
|
|
77
|
+
{children}
|
|
78
|
+
</Surface>
|
|
79
|
+
);
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
export function RootSurface(props: RootSurfaceProps) {
|
|
77
83
|
const { children, ref, ...rest } = props;
|
|
78
84
|
const isPanorama = useIsPanorama();
|
|
79
85
|
if (isPanorama) {
|
|
80
|
-
return
|
|
81
|
-
<
|
|
82
|
-
|
|
86
|
+
return (
|
|
87
|
+
<BrushPanoramaSurface>
|
|
88
|
+
<AllZIndexPortals isPanorama={true}>{children}</AllZIndexPortals>
|
|
89
|
+
</BrushPanoramaSurface>
|
|
90
|
+
);
|
|
83
91
|
}
|
|
84
|
-
return
|
|
85
|
-
<
|
|
86
|
-
|
|
92
|
+
return (
|
|
93
|
+
<MainChartSurface ref={ref} {...rest}>
|
|
94
|
+
<AllZIndexPortals isPanorama={false}>{children}</AllZIndexPortals>
|
|
95
|
+
</MainChartSurface>
|
|
96
|
+
);
|
|
87
97
|
}
|
|
@@ -21,17 +21,19 @@ export function Surface(props: Props) {
|
|
|
21
21
|
const { children, width, height, viewBox, className, style, title, desc, ref, ...others } = props;
|
|
22
22
|
const svgView = viewBox || { width, height, x: 0, y: 0 };
|
|
23
23
|
const layerClass = clsx('recharts-surface', className);
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
return (
|
|
25
|
+
<svg
|
|
26
|
+
{...svgPropertiesAndEvents(others)}
|
|
27
|
+
className={layerClass}
|
|
28
|
+
width={width}
|
|
29
|
+
height={height}
|
|
30
|
+
style={style}
|
|
31
|
+
viewBox={svgView.x + ' ' + svgView.y + ' ' + svgView.width + ' ' + svgView.height}
|
|
32
|
+
ref={ref}
|
|
33
|
+
>
|
|
34
|
+
<title>{title}</title>
|
|
35
|
+
<desc>{desc}</desc>
|
|
36
|
+
{children}
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
37
39
|
}
|
|
@@ -31,11 +31,11 @@ const initialContextState: ErrorBarContextType<any> = {
|
|
|
31
31
|
|
|
32
32
|
const ErrorBarContext = createContext(initialContextState);
|
|
33
33
|
|
|
34
|
-
export function SetErrorBarContext<
|
|
35
|
-
T
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
export function SetErrorBarContext<T extends BarRectangleItem | LinePointItem | ScatterPointItem>(
|
|
35
|
+
props: ErrorBarContextType<T> & {
|
|
36
|
+
children: OctaneNode;
|
|
37
|
+
},
|
|
38
|
+
) {
|
|
39
39
|
const { children, ...rest } = props;
|
|
40
40
|
return <ErrorBarContext value={rest}>{children}</ErrorBarContext>;
|
|
41
41
|
}
|