@octanejs/recharts 0.1.61 → 0.1.63

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.
Files changed (73) hide show
  1. package/package.json +5 -5
  2. package/src/animation/AnimatedItems.tsrx +36 -31
  3. package/src/animation/CSSTransitionAnimate.tsrx +1 -2
  4. package/src/animation/JavascriptAnimate.tsrx +1 -2
  5. package/src/cartesian/Area.tsrx +414 -386
  6. package/src/cartesian/AreaRevealShape.tsrx +103 -84
  7. package/src/cartesian/Bar.tsrx +343 -317
  8. package/src/cartesian/BarStack.tsrx +33 -28
  9. package/src/cartesian/CartesianAxis.tsrx +168 -165
  10. package/src/cartesian/CartesianGrid.tsrx +256 -272
  11. package/src/cartesian/ErrorBar.tsrx +108 -104
  12. package/src/cartesian/Funnel.tsrx +405 -382
  13. package/src/cartesian/GraphicalItemClipPath.tsrx +4 -8
  14. package/src/cartesian/Line.tsrx +190 -177
  15. package/src/cartesian/LineDrawShape.tsrx +14 -15
  16. package/src/cartesian/ReferenceLine.tsrx +119 -105
  17. package/src/cartesian/Scatter.tsrx +416 -398
  18. package/src/cartesian/XAxis.tsrx +39 -32
  19. package/src/cartesian/YAxis.tsrx +47 -37
  20. package/src/cartesian/ZAxis.tsrx +76 -73
  21. package/src/chart/AreaChart.tsrx +15 -11
  22. package/src/chart/BarChart.tsrx +15 -11
  23. package/src/chart/CategoricalChart.tsrx +32 -26
  24. package/src/chart/ComposedChart.tsrx +15 -11
  25. package/src/chart/FunnelChart.tsrx +15 -11
  26. package/src/chart/LineChart.tsrx +15 -11
  27. package/src/chart/PieChart.tsrx +15 -11
  28. package/src/chart/PolarChart.tsrx +45 -48
  29. package/src/chart/RadarChart.tsrx +38 -32
  30. package/src/chart/RadialBarChart.tsrx +15 -11
  31. package/src/chart/RechartsWrapper.tsrx +214 -162
  32. package/src/chart/Sankey.tsrx +412 -378
  33. package/src/chart/ScatterChart.tsrx +15 -11
  34. package/src/chart/SunburstChart.tsrx +162 -155
  35. package/src/component/ActivePoints.tsrx +19 -13
  36. package/src/component/Cursor.tsrx +25 -18
  37. package/src/component/DefaultLegendContent.tsrx +131 -127
  38. package/src/component/DefaultTooltipContent.tsrx +46 -42
  39. package/src/component/Dots.tsrx +11 -5
  40. package/src/component/Label.tsrx +69 -55
  41. package/src/component/LabelList.tsrx +32 -27
  42. package/src/component/Legend.tsrx +120 -123
  43. package/src/component/ResponsiveContainer.tsrx +18 -11
  44. package/src/component/Text.tsrx +50 -43
  45. package/src/component/Tooltip.tsrx +234 -223
  46. package/src/component/TooltipBoundingBox.tsrx +34 -34
  47. package/src/container/ClipPathProvider.tsrx +1 -3
  48. package/src/container/Layer.tsrx +5 -1
  49. package/src/container/RootSurface.tsrx +31 -21
  50. package/src/container/Surface.tsrx +15 -13
  51. package/src/context/ErrorBarContext.tsrx +5 -5
  52. package/src/polar/Pie.tsrx +541 -487
  53. package/src/polar/PolarAngleAxis.tsrx +245 -227
  54. package/src/polar/PolarGrid.tsrx +139 -127
  55. package/src/polar/PolarRadiusAxis.tsrx +204 -185
  56. package/src/polar/Radar.tsrx +274 -264
  57. package/src/polar/RadialBar.tsrx +408 -361
  58. package/src/shape/Cross.tsrx +13 -7
  59. package/src/shape/Curve.tsrx +54 -44
  60. package/src/shape/Dot.tsrx +10 -8
  61. package/src/shape/Polygon.tsrx +38 -29
  62. package/src/shape/Rectangle.tsrx +73 -28
  63. package/src/shape/Sector.tsrx +30 -18
  64. package/src/shape/Symbols.tsrx +13 -11
  65. package/src/shape/Trapezoid.tsrx +16 -11
  66. package/src/state/RechartsStoreProvider.tsrx +5 -1
  67. package/src/synchronisation/useChartSynchronisation.tsrx +8 -7
  68. package/src/util/BarUtils.tsrx +43 -40
  69. package/src/util/FunnelUtils.tsrx +5 -5
  70. package/src/util/RadialBarUtils.tsrx +3 -4
  71. package/src/util/ScatterUtils.tsrx +13 -8
  72. package/src/zIndex/ZIndexLayer.tsrx +2 -2
  73. package/src/zIndex/ZIndexPortal.tsrx +2 -8
@@ -34,12 +34,14 @@ function HorizontalClipRect({ alpha, baseLine, points, strokeWidth }: ClipRectPr
34
34
  }
35
35
 
36
36
  if (isNumber(maxY)) {
37
- return <rect
38
- x={startX < endX ? startX : startX - width}
39
- y={0}
40
- width={width}
41
- height={Math.floor(maxY + (strokeWidth ? parseInt(`${strokeWidth}`, 10) : 1))}
42
- />;
37
+ return (
38
+ <rect
39
+ x={startX < endX ? startX : startX - width}
40
+ y={0}
41
+ width={width}
42
+ height={Math.floor(maxY + (strokeWidth ? parseInt(`${strokeWidth}`, 10) : 1))}
43
+ />
44
+ );
43
45
  }
44
46
 
45
47
  return null;
@@ -61,39 +63,51 @@ function VerticalClipRect({ alpha, baseLine, points, strokeWidth }: ClipRectProp
61
63
  }
62
64
 
63
65
  if (isNumber(maxX)) {
64
- return <rect
65
- x={0}
66
- y={startY < endY ? startY : startY - height}
67
- width={maxX + (strokeWidth ? parseInt(`${strokeWidth}`, 10) : 1)}
68
- height={Math.floor(height)}
69
- />;
66
+ return (
67
+ <rect
68
+ x={0}
69
+ y={startY < endY ? startY : startY - height}
70
+ width={maxX + (strokeWidth ? parseInt(`${strokeWidth}`, 10) : 1)}
71
+ height={Math.floor(height)}
72
+ />
73
+ );
70
74
  }
71
75
 
72
76
  return null;
73
77
  }
74
78
 
75
- function RevealClipRect({ alpha, layout, points, baseLine, strokeWidth }: ClipRectProps & {
79
+ function RevealClipRect({
80
+ alpha,
81
+ layout,
82
+ points,
83
+ baseLine,
84
+ strokeWidth,
85
+ }: ClipRectProps & {
76
86
  layout: CartesianLayout;
77
87
  }) {
78
88
  if (layout === 'vertical') {
79
- return <VerticalClipRect
89
+ return (
90
+ <VerticalClipRect
91
+ alpha={alpha}
92
+ points={points}
93
+ baseLine={baseLine}
94
+ strokeWidth={strokeWidth}
95
+ />
96
+ );
97
+ }
98
+
99
+ return (
100
+ <HorizontalClipRect
80
101
  alpha={alpha}
81
102
  points={points}
82
103
  baseLine={baseLine}
83
104
  strokeWidth={strokeWidth}
84
- />;
85
- }
86
-
87
- return <HorizontalClipRect
88
- alpha={alpha}
89
- points={points}
90
- baseLine={baseLine}
91
- strokeWidth={strokeWidth}
92
- />;
105
+ />
106
+ );
93
107
  }
94
108
 
95
- export type AreaRevealShapeProps =
96
- CurveProps & ShapeAnimationProps & { layout?: LayoutType; isRange?: boolean };
109
+ export type AreaRevealShapeProps = CurveProps &
110
+ ShapeAnimationProps & { layout?: LayoutType; isRange?: boolean };
97
111
 
98
112
  /**
99
113
  * The default shape for Area that reveals the chart with a left-to-right (or top-to-bottom)
@@ -129,74 +143,79 @@ export function AreaRevealShape(props: AreaRevealShapeProps): OctaneElement | nu
129
143
  connectNulls,
130
144
  ...restProps
131
145
  } = props;
132
- const layout: CartesianLayout =
133
- layoutProp === 'vertical' ? 'vertical' : 'horizontal';
146
+ const layout: CartesianLayout = layoutProp === 'vertical' ? 'vertical' : 'horizontal';
134
147
  const finalConnectNulls = connectNulls ?? false;
135
148
  const clipId = useId();
136
149
 
137
150
  const { id, baseLine, ...propsWithoutIdBaseline } = restProps;
138
151
  const strokeSvgProps = svgPropertiesNoEvents(propsWithoutIdBaseline);
139
152
 
140
- const fillCurve = <Curve
141
- {...restProps}
142
- id={id}
143
- baseLine={baseLine}
144
- connectNulls={finalConnectNulls}
145
- stroke="none"
146
- className="recharts-area-area"
147
- layout={layout}
148
- />;
149
-
150
- const strokeCurve =
151
- stroke !== 'none' &&
152
- <Curve
153
- {...strokeSvgProps}
154
- className="recharts-area-curve"
155
- layout={layout}
156
- type={restProps.type}
157
- connectNulls={finalConnectNulls}
158
- fill="none"
159
- stroke={stroke}
160
- points={restProps.points}
161
- />;
162
-
163
- const baselineCurve =
164
- stroke !== 'none' && isRange && Array.isArray(baseLine) &&
165
- <Curve
166
- {...strokeSvgProps}
167
- className="recharts-area-curve"
168
- layout={layout}
169
- type={restProps.type}
170
- connectNulls={finalConnectNulls}
171
- fill="none"
172
- stroke={stroke}
173
- points={baseLine}
174
- />;
153
+ const fillCurve = (
154
+ <Curve
155
+ {...restProps}
156
+ id={id}
157
+ baseLine={baseLine}
158
+ connectNulls={finalConnectNulls}
159
+ stroke="none"
160
+ className="recharts-area-area"
161
+ layout={layout}
162
+ />
163
+ );
164
+
165
+ const strokeCurve = stroke !== 'none' && (
166
+ <Curve
167
+ {...strokeSvgProps}
168
+ className="recharts-area-curve"
169
+ layout={layout}
170
+ type={restProps.type}
171
+ connectNulls={finalConnectNulls}
172
+ fill="none"
173
+ stroke={stroke}
174
+ points={restProps.points}
175
+ />
176
+ );
177
+
178
+ const baselineCurve = stroke !== 'none' && isRange && Array.isArray(baseLine) && (
179
+ <Curve
180
+ {...strokeSvgProps}
181
+ className="recharts-area-curve"
182
+ layout={layout}
183
+ type={restProps.type}
184
+ connectNulls={finalConnectNulls}
185
+ fill="none"
186
+ stroke={stroke}
187
+ points={baseLine}
188
+ />
189
+ );
175
190
 
176
191
  if (isEntrance && (isAnimating || animationElapsedTime < 1)) {
177
- return <Layer>
178
- <defs>
179
- <clipPath id={clipId}>
180
- <RevealClipRect
181
- alpha={animationElapsedTime}
182
- points={restProps.points ?? []}
183
- baseLine={baseLine}
184
- layout={layout}
185
- strokeWidth={restProps.strokeWidth}
186
- />
187
- </clipPath>
188
- </defs>
189
- <Layer clipPath={`url(#${clipId})`}>
190
- {fillCurve}
191
- {strokeCurve}
192
- {baselineCurve}
192
+ return (
193
+ <Layer>
194
+ <defs>
195
+ <clipPath id={clipId}>
196
+ <RevealClipRect
197
+ alpha={animationElapsedTime}
198
+ points={restProps.points ?? []}
199
+ baseLine={baseLine}
200
+ layout={layout}
201
+ strokeWidth={restProps.strokeWidth}
202
+ />
203
+ </clipPath>
204
+ </defs>
205
+ <Layer clipPath={`url(#${clipId})`}>
206
+ {fillCurve}
207
+ {strokeCurve}
208
+ {baselineCurve}
209
+ </Layer>
193
210
  </Layer>
194
- </Layer>;
211
+ );
195
212
  }
196
213
 
197
- return <>
198
- {fillCurve}
199
- {strokeCurve}
200
- {baselineCurve}
201
- </>;
214
+ return (
215
+ <>
216
+ {fillCurve}
217
+ {strokeCurve}
218
+ {baselineCurve}
219
+ </>
220
+ );
202
221
  }