Skip to content

Commit a50c281

Browse files
authored
fix(charts): fix Victory 37.3.4 issues (#11355)
#11354
1 parent 0eb8f37 commit a50c281

File tree

6 files changed

+171
-169
lines changed

6 files changed

+171
-169
lines changed

packages/react-charts/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@
3333
"hoist-non-react-statics": "^3.3.2",
3434
"lodash": "^4.17.21",
3535
"tslib": "^2.7.0",
36-
"victory-area": "^37.1.1",
37-
"victory-axis": "^37.1.1",
38-
"victory-bar": "^37.1.1",
39-
"victory-box-plot": "^37.1.1",
40-
"victory-chart": "^37.1.1",
41-
"victory-core": "^37.1.1",
42-
"victory-create-container": "^37.1.1",
43-
"victory-cursor-container": "^37.1.1",
44-
"victory-group": "^37.1.1",
45-
"victory-legend": "^37.1.1",
46-
"victory-line": "^37.1.1",
47-
"victory-pie": "^37.1.1",
48-
"victory-scatter": "^37.1.1",
49-
"victory-stack": "^37.1.1",
50-
"victory-tooltip": "^37.1.1",
51-
"victory-voronoi-container": "^37.1.1",
52-
"victory-zoom-container": "^37.1.1"
36+
"victory-area": "^37.3.4",
37+
"victory-axis": "^37.3.4",
38+
"victory-bar": "^37.3.4",
39+
"victory-box-plot": "^37.3.4",
40+
"victory-chart": "^37.3.4",
41+
"victory-core": "^37.3.4",
42+
"victory-create-container": "^37.3.4",
43+
"victory-cursor-container": "^37.3.4",
44+
"victory-group": "^37.3.4",
45+
"victory-legend": "^37.3.4",
46+
"victory-line": "^37.3.4",
47+
"victory-pie": "^37.3.4",
48+
"victory-scatter": "^37.3.4",
49+
"victory-stack": "^37.3.4",
50+
"victory-tooltip": "^37.3.4",
51+
"victory-voronoi-container": "^37.3.4",
52+
"victory-zoom-container": "^37.3.4"
5353
},
5454
"peerDependencies": {
5555
"react": "^17 || ^18",

packages/react-charts/src/components/ChartBar/ChartBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,4 +482,4 @@ export const ChartBar: React.FunctionComponent<ChartBarProps> = ({
482482
ChartBar.displayName = 'ChartBar';
483483

484484
// Note: VictoryBar.getDomain & VictoryBar.role must be hoisted
485-
hoistNonReactStatics(ChartBar, VictoryBar);
485+
hoistNonReactStatics(ChartBar, VictoryBar, { getBaseProps: true });

packages/react-charts/src/components/ChartUtils/chart-legend.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import defaults from 'lodash/defaults';
2-
import { Helpers, PaddingProps, TextSize } from 'victory-core';
2+
import { Helpers, TextSize } from 'victory-core';
33
import { VictoryLegend } from 'victory-legend';
44
import { ChartLegendProps } from '../ChartLegend/ChartLegend';
55
import { ChartCommonStyles } from '../ChartTheme/ChartStyles';
66
import { ChartThemeDefinition } from '../ChartTheme/ChartTheme';
77
import { getLabelTextSize } from '../ChartUtils/chart-label';
88
import { getPieOrigin } from './chart-origin';
99
import * as React from 'react';
10+
import { ElementPadding } from 'victory-core/src/victory-util/helpers';
1011

1112
interface ChartLegendInterface {
1213
allowWrap?: boolean; // Allow legend items to wrap to the next line
@@ -17,7 +18,7 @@ interface ChartLegendInterface {
1718
height: number; // Overall height of SVG
1819
legendComponent: React.ReactElement<any>; // The base legend component to render
1920
orientation?: 'horizontal' | 'vertical'; // Orientation of legend
20-
padding: PaddingProps; // Chart padding
21+
padding: ElementPadding; // Chart padding
2122
patternScale?: string[]; // Legend symbol patterns
2223
position: 'bottom' | 'bottom-left' | 'right'; // The legend position
2324
theme: ChartThemeDefinition; // The theme that will be applied to the chart
@@ -41,7 +42,7 @@ interface ChartLegendPositionInterface {
4142
legendOrientation: 'horizontal' | 'vertical'; // Orientation of legend
4243
legendPosition: 'bottom' | 'bottom-left' | 'right'; // Position of legend
4344
legendProps: any; // The legend props used to determine width
44-
padding?: PaddingProps; // Chart padding
45+
padding?: ElementPadding; // Chart padding
4546
theme: ChartThemeDefinition; // The theme that will be applied to the chart
4647
width?: number; // Overall width of SVG
4748
}
@@ -187,7 +188,7 @@ const doesLegendFit = ({
187188
theme,
188189
width
189190
}: ChartLegendPositionInterface) => {
190-
const { left, right } = Helpers.getPadding({ padding });
191+
const { left, right } = Helpers.getPadding(padding);
191192
const chartSize = {
192193
height, // Fixed size
193194
width: width - left - right
@@ -322,7 +323,7 @@ const getBulletLegendY = ({
322323
theme,
323324
width
324325
}: ChartLegendPositionInterface) => {
325-
const { left, right } = Helpers.getPadding({ padding });
326+
const { left, right } = Helpers.getPadding(padding);
326327
const chartSize = {
327328
height, // Fixed size
328329
width: width - left - right
@@ -363,7 +364,7 @@ const getChartLegendX = ({
363364
theme,
364365
width
365366
}: ChartLegendPositionInterface) => {
366-
const { top, bottom, left, right } = Helpers.getPadding({ padding });
367+
const { top, bottom, left, right } = Helpers.getPadding(padding);
367368
const chartSize = {
368369
height: Math.abs(height - (bottom + top)),
369370
width: Math.abs(width - (left + right))
@@ -402,7 +403,7 @@ const getChartLegendY = ({
402403
theme,
403404
width
404405
}: ChartLegendPositionInterface) => {
405-
const { top, bottom, left, right } = Helpers.getPadding({ padding });
406+
const { top, bottom, left, right } = Helpers.getPadding(padding);
406407
const chartSize = {
407408
height: Math.abs(height - (bottom + top)),
408409
width: Math.abs(width - (left + right))

packages/react-charts/src/components/ChartUtils/chart-origin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ChartPieOriginInterface {
1212
* @private
1313
*/
1414
export const getPieOrigin = ({ height, padding, width }: ChartPieOriginInterface) => {
15-
const { top, bottom, left, right } = Helpers.getPadding({ padding });
15+
const { top, bottom, left, right } = Helpers.getPadding(padding);
1616
const radius = Helpers.getRadius({ height, width, padding });
1717
const offsetX = (width - radius * 2 - left - right) / 2;
1818
const offsetY = (height - radius * 2 - top - bottom) / 2;

packages/react-charts/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"rootDir": "./src",
55
"outDir": "./dist/esm",
6-
"tsBuildInfoFile": "dist/esm.tsbuildinfo"
6+
"tsBuildInfoFile": "dist/esm.tsbuildinfo",
7+
"noImplicitAny": false,
78
},
89
"include": [
910
"./src/*",

0 commit comments

Comments
 (0)