File tree Expand file tree Collapse file tree 1 file changed +44
-1
lines changed
apps/web/src/components/v2Editor/customBlocks/visualizationV2 Expand file tree Collapse file tree 1 file changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -331,8 +331,51 @@ function BrieferResult(props: {
331
331
} ,
332
332
grid,
333
333
xAxis : xAxes . map ( ( axis ) => axis . option ) ,
334
- yAxis : props . result . yAxis . map ( ( axis ) => ( {
334
+ yAxis : props . result . yAxis . map ( ( axis , i ) => ( {
335
335
...axis ,
336
+ axisLabel : {
337
+ formatter : ( value : string | number ) : string => {
338
+ const format :
339
+ | null
340
+ | { _tag : 'date' ; format : DateFormat }
341
+ | { _tag : 'number' ; format : NumberFormat } =
342
+ props . input . yAxes [ i ] ?. series
343
+ . map ( ( s ) => {
344
+ if ( ! s . column ) {
345
+ return null
346
+ }
347
+
348
+ if ( NumpyDateTypes . safeParse ( s . column . type ) . success ) {
349
+ if ( s . dateFormat ) {
350
+ return { _tag : 'date' as const , format : s . dateFormat }
351
+ }
352
+ }
353
+
354
+ if ( NumpyNumberTypes . safeParse ( s . column . type ) . success ) {
355
+ if ( s . numberFormat ) {
356
+ return { _tag : 'number' as const , format : s . numberFormat }
357
+ }
358
+ }
359
+
360
+ return null
361
+ } )
362
+ . find ( ( f ) => f !== null ) ?? null
363
+
364
+ if ( ! format ) {
365
+ return value . toString ( )
366
+ }
367
+
368
+ if ( typeof value === 'number' && format . _tag === 'number' ) {
369
+ return formatNumber ( value , format . format )
370
+ }
371
+
372
+ if ( format . _tag === 'date' ) {
373
+ return formatDateTime ( value , format . format )
374
+ }
375
+
376
+ return value . toString ( )
377
+ } ,
378
+ } ,
336
379
} ) ) ,
337
380
tooltip : {
338
381
...props . result . tooltip ,
You can’t perform that action at this time.
0 commit comments