Skip to content

Commit 2e59bbb

Browse files
refactor(Charts - New): update to recharts beta 6 (#506)
1 parent acd79b8 commit 2e59bbb

5 files changed

Lines changed: 16 additions & 490 deletions

File tree

config/jest.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ module.exports = {
2121
'!packages/base/src/styling/HSLColor.ts', // no deprecated HSL Util
2222
'!packages/base/src/styling/font72.ts', // no deprecated font
2323
'!packages/base/src/Scroller/*', // no scroll lib as it is not longer used
24-
'!packages/base/src/utils/Event.ts', // event is deprecated
25-
'!packages/charts/src/internal/ChartLabel.tsx' // temp copy of recharts label
24+
'!packages/base/src/utils/Event.ts' // event is deprecated
2625
],
2726
setupFiles: ['jest-canvas-mock'],
2827
setupFilesAfterEnv: ['./config/jestsetup.ts'],

packages/charts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"lodash.merge": "^4.6.2",
3030
"react-chartjs-2": "^2.8.0",
3131
"react-content-loader": "^5.0.4",
32-
"recharts": "2.0.0-beta.5"
32+
"recharts": "2.0.0-beta.6"
3333
},
3434
"devDependencies": {
3535
"@types/chart.js": "^2.9.8"

packages/charts/src/internal/ChartDataLabel.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters';
22
import { getTextWidth } from '@ui5/webcomponents-react-charts/lib/Utils';
3-
import React, { FC } from 'react';
3+
import React, { FC, createElement } from 'react';
44
import { IChartMeasure } from '../interfaces/IChartMeasure';
5-
import Label from './ChartLabel';
5+
import { Label } from 'recharts';
66

77
interface CustomDataLabelProps {
88
config: IChartMeasure;
@@ -14,16 +14,14 @@ interface CustomDataLabelProps {
1414
}
1515

1616
export const ChartDataLabel: FC<CustomDataLabelProps> = (props: CustomDataLabelProps) => {
17-
const { config, chartType } = props;
18-
19-
const viewBox = Label.parseViewBox(props);
17+
const { config, chartType, viewBox } = props;
2018

2119
if (config.hideDataLabel) {
2220
return null;
2321
}
2422

2523
if (config.DataLabel) {
26-
return config.DataLabel(props);
24+
return createElement(config.DataLabel, props);
2725
}
2826

2927
const formattedLabel = config.formatter(props.value ?? props.children);

0 commit comments

Comments
 (0)