Skip to content

Commit 4a7cfa1

Browse files
leonardomendixgjulivan
authored andcommitted
refactor(custom-chart-web): change event data to return more properties
1 parent 6badb11 commit 4a7cfa1

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

packages/pluggableWidgets/custom-chart-web/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+
### Changed
10+
11+
- We changed the event data to return more properties instead of only bbox coordinates.
12+
913
## [1.2.2] - 2025-09-21
1014

1115
### Fixed

packages/pluggableWidgets/custom-chart-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mendix/custom-chart-web",
33
"widgetName": "CustomChart",
4-
"version": "1.2.2",
4+
"version": "1.2.3",
55
"description": "Create customizable charts with Plotly.js for advanced visualization needs",
66
"copyright": "© Mendix Technology BV 2025. All rights reserved.",
77
"license": "Apache-2.0",

packages/pluggableWidgets/custom-chart-web/src/controllers/ChartPropsController.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,21 @@ export class ChartPropsController implements ReactiveController {
124124

125125
private get chartOnClick(): (data: any) => void {
126126
return (data: any): void => {
127-
if (this.props.eventDataAttribute) {
128-
this.props.eventDataAttribute.setValue(JSON.stringify(data.points[0].bbox));
127+
if (this.props.eventDataAttribute && data.points && data.points.length > 0) {
128+
const point = data.points[0];
129+
const eventData = {
130+
curveNumber: point.curveNumber,
131+
pointNumber: point.pointNumber,
132+
pointIndex: point.pointIndex,
133+
x: point.x,
134+
y: point.y,
135+
z: point.z, // for 3D charts
136+
text: point.text,
137+
hovertext: point.hovertext,
138+
customdata: point.customdata,
139+
bbox: point.bbox
140+
};
141+
this.props.eventDataAttribute.setValue(JSON.stringify(eventData));
129142
}
130143
executeAction(this.props.onClick);
131144
};

packages/pluggableWidgets/custom-chart-web/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="CustomChart" version="1.2.2" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="CustomChart" version="1.2.3" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="CustomChart.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)