@@ -1329,34 +1329,56 @@ export async function fetchScatterData(
13291329 if ( handleMinMaxRow ) {
13301330 handleMinMaxRow ( reqIdStr , row ) ;
13311331 } else {
1332+ // Convert to number first if BigInt
1333+ const rawMinX = typeof row [ aliasKey ( "min" , `${ x } ` ) ] === 'bigint'
1334+ ? Number ( row [ aliasKey ( "min" , `${ x } ` ) ] )
1335+ : row [ aliasKey ( "min" , `${ x } ` ) ] ;
1336+ const rawMaxX = typeof row [ aliasKey ( "max" , `${ x } ` ) ] === 'bigint'
1337+ ? Number ( row [ aliasKey ( "max" , `${ x } ` ) ] )
1338+ : row [ aliasKey ( "max" , `${ x } ` ) ] ;
1339+
13321340 if ( options . parentMinX ) {
13331341 minXtoUse = options . parentMinX ;
13341342 } else {
1335- minXtoUse = row [ aliasKey ( "min" , ` ${ x } ` ) ] ;
1343+ minXtoUse = rawMinX ;
13361344 }
1337- if ( minXtoUse === row [ aliasKey ( "min" , ` ${ x } ` ) ] ) {
1338- console . log ( 'fetchScatterData minXtoUse:' , minXtoUse , `row['min_${ x } ']:` , row [ aliasKey ( "min" , ` ${ x } ` ) ] ) ;
1345+ if ( minXtoUse === rawMinX ) {
1346+ console . log ( 'fetchScatterData minXtoUse:' , minXtoUse , `row['min_${ x } ']:` , rawMinX ) ;
13391347 } else {
1340- console . warn ( 'fetchScatterData minXtoUse:' , minXtoUse , `row['min_${ x } ']:` , row [ aliasKey ( "min" , ` ${ x } ` ) ] ) ;
1348+ console . warn ( 'fetchScatterData minXtoUse:' , minXtoUse , `row['min_${ x } ']:` , rawMinX ) ;
13411349 }
13421350 // set min/max in the store
1343- useChartStore ( ) . setRawMinX ( reqIdStr , row [ aliasKey ( "min" , ` ${ x } ` ) ] ) ;
1344- useChartStore ( ) . setMinX ( reqIdStr , row [ aliasKey ( "min" , ` ${ x } ` ) ] - minXtoUse ) ;
1345- useChartStore ( ) . setMaxX ( reqIdStr , row [ aliasKey ( "max" , ` ${ x } ` ) ] - minXtoUse ) ;
1351+ useChartStore ( ) . setRawMinX ( reqIdStr , rawMinX ) ;
1352+ useChartStore ( ) . setMinX ( reqIdStr , rawMinX - minXtoUse ) ;
1353+ useChartStore ( ) . setMaxX ( reqIdStr , rawMaxX - minXtoUse ) ;
13461354 }
13471355
13481356 // Populate minMaxValues, but exclude NaN values (should be unnecessary now that we filter in SQL)
1349- if ( ! isNaN ( row [ aliasKey ( "min" , `${ x } ` ) ] ) && ! isNaN ( row [ aliasKey ( "max" , `${ x } ` ) ] ) ) {
1357+ // Convert to number first if BigInt
1358+ const minX = typeof row [ aliasKey ( "min" , `${ x } ` ) ] === 'bigint'
1359+ ? Number ( row [ aliasKey ( "min" , `${ x } ` ) ] )
1360+ : row [ aliasKey ( "min" , `${ x } ` ) ] ;
1361+ const maxX = typeof row [ aliasKey ( "max" , `${ x } ` ) ] === 'bigint'
1362+ ? Number ( row [ aliasKey ( "max" , `${ x } ` ) ] )
1363+ : row [ aliasKey ( "max" , `${ x } ` ) ] ;
1364+ const lowX = typeof row [ aliasKey ( "low" , `${ x } ` ) ] === 'bigint'
1365+ ? Number ( row [ aliasKey ( "low" , `${ x } ` ) ] )
1366+ : row [ aliasKey ( "low" , `${ x } ` ) ] ;
1367+ const highX = typeof row [ aliasKey ( "high" , `${ x } ` ) ] === 'bigint'
1368+ ? Number ( row [ aliasKey ( "high" , `${ x } ` ) ] )
1369+ : row [ aliasKey ( "high" , `${ x } ` ) ] ;
1370+
1371+ if ( ! isNaN ( minX ) && ! isNaN ( maxX ) ) {
13501372 minMaxLowHigh [ `x` ] = { // genericize the name to x
1351- min : row [ aliasKey ( "min" , ` ${ x } ` ) ] ,
1352- max : row [ aliasKey ( "max" , ` ${ x } ` ) ] ,
1353- low : row [ aliasKey ( "low" , ` ${ x } ` ) ] ,
1354- high : row [ aliasKey ( "high" , ` ${ x } ` ) ]
1373+ min : minX ,
1374+ max : maxX ,
1375+ low : lowX ,
1376+ high : highX
13551377 }
1356-
1378+
13571379 } else {
13581380 console . log ( 'aliasKey("min", x):' , aliasKey ( "min" , `${ x } ` ) ) ;
1359- console . error ( 'fetchScatterData: min/max x is NaN:' , row [ aliasKey ( "min" , ` ${ x } ` ) ] , row [ aliasKey ( "max" , ` ${ x } ` ) ] ) ;
1381+ console . error ( 'fetchScatterData: min/max x is NaN:' , minX , maxX ) ;
13601382 }
13611383
13621384 y . forEach ( ( yName ) => {
@@ -1461,18 +1483,24 @@ export async function fetchScatterData(
14611483 ) ;
14621484 } else {
14631485 // Default transformation:
1464- const xVal = normalizeX ? row [ x ] - minXtoUse : row [ x ] ;
1486+ // Convert to number first if BigInt
1487+ const xRawVal = typeof row [ x ] === 'bigint' ? Number ( row [ x ] ) : row [ x ] ;
1488+ const xVal = normalizeX ? xRawVal - minXtoUse : xRawVal ;
14651489 rowValues = [ xVal ] ;
14661490 orderNdx = setDataOrder ( dataOrderNdx , 'x' , orderNdx ) ;
14671491
14681492 y . forEach ( ( yName ) => {
1469- rowValues . push ( row [ yName ] ) ;
1493+ // Convert to number first if BigInt
1494+ const yVal = typeof row [ yName ] === 'bigint' ? Number ( row [ yName ] ) : row [ yName ] ;
1495+ rowValues . push ( yVal ) ;
14701496 orderNdx = setDataOrder ( dataOrderNdx , yName , orderNdx ) ;
14711497 } ) ;
14721498
14731499 if ( extraSelectColumns . length > 0 ) {
14741500 extraSelectColumns . forEach ( ( colName ) => {
1475- rowValues . push ( row [ colName ] ) ;
1501+ // Convert to number first if BigInt
1502+ const colVal = typeof row [ colName ] === 'bigint' ? Number ( row [ colName ] ) : row [ colName ] ;
1503+ rowValues . push ( colVal ) ;
14761504 orderNdx = setDataOrder ( dataOrderNdx , colName , orderNdx ) ;
14771505 } ) ;
14781506 }
0 commit comments