@@ -7,8 +7,8 @@ import { executeAction } from "@mendix/pluggable-widgets-commons";
77import { MendixChartDataProps } from "../components/Chart" ;
88
99type PlotChartDataPoints = {
10- x : Array < NonNullable < Datum > > ;
11- y : Array < NonNullable < Datum > > ;
10+ x : Datum [ ] ;
11+ y : Datum [ ] ;
1212 hovertext : string [ ] | undefined ;
1313 hoverinfo : PlotData [ "hoverinfo" ] ;
1414 // We want this optional.
@@ -206,12 +206,16 @@ function extractDataPoints(
206206 const x = xValue . get ( item ) ;
207207 const y = yValue . get ( item ) ;
208208
209- if ( ! x . value || ! y . value ) {
210- return null ;
209+ if ( ! x . value ) {
210+ xData . push ( null ) ;
211+ } else {
212+ xData . push ( x . value instanceof Big ? x . value . toNumber ( ) : x . value ) ;
213+ }
214+ if ( ! y . value ) {
215+ yData . push ( null ) ;
216+ } else {
217+ yData . push ( y . value instanceof Big ? y . value . toNumber ( ) : y . value ) ;
211218 }
212-
213- xData . push ( x . value instanceof Big ? Number ( x . value . toString ( ) ) : x . value ) ;
214- yData . push ( y . value instanceof Big ? Number ( y . value . toString ( ) ) : y . value ) ;
215219
216220 const tooltipHoverTextSource =
217221 series . dataSet === "dynamic" ? series . dynamicTooltipHoverText : series . staticTooltipHoverText ;
@@ -241,11 +245,14 @@ export function getPlotChartDataTransforms(
241245 return [
242246 {
243247 type : "aggregate" ,
244- groups : dataPoints . x . map ( dataPoint =>
245- typeof dataPoint === "string" || typeof dataPoint === "number"
248+ groups : dataPoints . x . map ( dataPoint => {
249+ if ( ! dataPoint ) {
250+ return "" ;
251+ }
252+ return typeof dataPoint === "string" || typeof dataPoint === "number"
246253 ? dataPoint . toLocaleString ( )
247- : dataPoint . toLocaleDateString ( )
248- ) ,
254+ : dataPoint . toLocaleDateString ( ) ;
255+ } ) ,
249256 aggregations : [
250257 {
251258 target : "y" ,
0 commit comments