File tree Expand file tree Collapse file tree 2 files changed +419
-2
lines changed
superset-frontend/plugins/plugin-chart-echarts Expand file tree Collapse file tree 2 files changed +419
-2
lines changed Original file line number Diff line number Diff line change @@ -222,8 +222,20 @@ export default function transformProps(
222222
223223 const { setDataMask = ( ) => { } , onContextMenu } = hooks ;
224224
225- const min = minVal ?? calculateMin ( transformedData ) ;
226- const max = maxVal ?? calculateMax ( transformedData ) ;
225+ const isValidNumber = (
226+ val : number | null | undefined | string ,
227+ ) : val is number => {
228+ if ( val == null || val === '' ) return false ;
229+ const num = typeof val === 'string' ? Number ( val ) : val ;
230+ return ! Number . isNaN ( num ) && Number . isFinite ( num ) ;
231+ } ;
232+
233+ const min = isValidNumber ( minVal )
234+ ? Number ( minVal )
235+ : calculateMin ( transformedData ) ;
236+ const max = isValidNumber ( maxVal )
237+ ? Number ( maxVal )
238+ : calculateMax ( transformedData ) ;
227239 const axisLabels = range ( min , max , ( max - min ) / splitNumber ) ;
228240 const axisLabelLength = Math . max (
229241 ...axisLabels . map ( label => numberFormatter ( label ) . length ) . concat ( [ 1 ] ) ,
You can’t perform that action at this time.
0 commit comments