Skip to content

Commit f880332

Browse files
authored
[MOO-1630]: Fix chart rendering issue (#238)
2 parents a3493f5 + 3a2acab commit f880332

File tree

16 files changed

+42
-37
lines changed

16 files changed

+42
-37
lines changed

packages/pluggableWidgets/bar-chart-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We have resolved an issue preventing Bar chart from rendering correctly.
12+
913
## [3.1.0] - 2024-12-3
1014

1115
### Changed

packages/pluggableWidgets/bar-chart-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bar-chart-native",
33
"widgetName": "BarChart",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"license": "Apache-2.0",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"repository": {

packages/pluggableWidgets/bar-chart-native/src/components/BarChart.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function BarChart({
5858
style,
5959
warningPrefix
6060
}: BarChartProps): ReactElement | null {
61-
const [chartDimensions, setChartDimensions] = useState<{ height: number; width: number }>();
61+
const [chartDimensions, setChartDimensions] = useState<{ height?: number; width?: number }>();
6262

6363
const warningMessagePrefix = useMemo(() => (warningPrefix ? warningPrefix + "i" : "I"), [warningPrefix]);
6464

@@ -133,16 +133,7 @@ export function BarChart({
133133
}
134134

135135
return <VictoryStack colorScale={normalizedBarColors}>{bars}</VictoryStack>;
136-
}, [
137-
dataTypesResult,
138-
series,
139-
style,
140-
warningMessagePrefix,
141-
sortProps,
142-
showLabels,
143-
normalizedBarColors,
144-
presentation
145-
]);
136+
}, [dataTypesResult, series, style, sortProps, showLabels, normalizedBarColors, presentation]);
146137

147138
const [firstSeries] = series;
148139

@@ -195,8 +186,8 @@ export function BarChart({
195186
(event: LayoutChangeEvent) => {
196187
const { height, width } = event.nativeEvent.layout;
197188
setChartDimensions({
198-
height: height <= 0 ? -1 : height,
199-
width: width <= 0 ? -1 : width
189+
height: height <= 0 ? undefined : height,
190+
width: width <= 0 ? undefined : width
200191
});
201192
},
202193
[setChartDimensions]
@@ -222,8 +213,8 @@ export function BarChart({
222213
// horizontal charts.
223214
<VictoryChart
224215
domainPadding={{ x: style.domain?.padding?.y, y: style.domain?.padding?.x }}
225-
height={chartDimensions?.height}
226-
width={chartDimensions?.width}
216+
height={chartDimensions.height}
217+
width={chartDimensions.width}
227218
padding={aggregateGridPadding(style.grid)}
228219
scale={
229220
dataTypesResult

packages/pluggableWidgets/bar-chart-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="BarChart" version="3.1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="BarChart" version="3.1.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="BarChart.xml" />
66
</widgetFiles>

packages/pluggableWidgets/column-chart-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We have resolved an issue preventing Column chart from rendering correctly
12+
913
## [2.1.0] - 2024-12-3
1014

1115
### Changed

packages/pluggableWidgets/column-chart-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "column-chart-native",
33
"widgetName": "ColumnChart",
4-
"version": "2.1.0",
4+
"version": "2.1.1",
55
"license": "Apache-2.0",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"repository": {

packages/pluggableWidgets/column-chart-native/src/components/ColumnChart.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function ColumnChart({
6666
return sortSeriesDataPoints(series, sortOrder, dataTypesResult);
6767
}, [sortOrder, series, dataTypesResult]);
6868

69-
const [chartDimensions, setChartDimensions] = useState<{ height: number; width: number }>();
69+
const [chartDimensions, setChartDimensions] = useState<{ height?: number; width?: number }>();
7070

7171
// Column Chart user-styling may be missing for certain series. A palette is passed, any missing colours
7272
// fallback to a colour from the palette.
@@ -153,8 +153,8 @@ export function ColumnChart({
153153
(event: LayoutChangeEvent) => {
154154
const { height, width } = event.nativeEvent.layout;
155155
setChartDimensions({
156-
height: height <= 0 ? -1 : height,
157-
width: width <= 0 ? -1 : width
156+
height: height <= 0 ? undefined : height,
157+
width: width <= 0 ? undefined : width
158158
});
159159
},
160160
[setChartDimensions]
@@ -178,10 +178,8 @@ export function ColumnChart({
178178
{chartDimensions ? (
179179
<VictoryChart
180180
domainPadding={{ x: style.domain?.padding?.x, y: style.domain?.padding?.y }}
181-
// width and height can't be zero
182-
// TODO: this needs to be checked for bar chart
183-
height={chartDimensions?.height || undefined}
184-
width={chartDimensions?.width || undefined}
181+
height={chartDimensions.height}
182+
width={chartDimensions.width}
185183
padding={aggregateGridPadding(style.grid)}
186184
scale={
187185
dataTypesResult

packages/pluggableWidgets/column-chart-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="ColumnChart" version="2.1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="ColumnChart" version="2.1.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="ColumnChart.xml" />
66
</widgetFiles>

packages/pluggableWidgets/line-chart-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We have resolved an issue preventing Line chart from rendering correctly
12+
913
## [3.1.0] - 2024-12-3
1014

1115
### Changed

packages/pluggableWidgets/line-chart-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "line-chart-native",
33
"widgetName": "LineChart",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)