File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
src/helpers/unitConversion Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,13 @@ export default chart => {
42
42
} )
43
43
}
44
44
45
- const offVisibleDimensionsChanged = chart . on ( "visibleDimensionsChanged" , ( ) => {
45
+ const onConvert = ( ymin , ymax ) => {
46
+ if ( Array . isArray ( chart . getAttribute ( "staticValueRange" ) ) ) {
47
+ const [ min , max ] = chart . getAttribute ( "staticValueRange" )
48
+ convert ( min , max )
49
+ return
50
+ }
51
+
46
52
const result = chart . getPayload ( )
47
53
48
54
const dimMinMax = result ?. byDimension
@@ -58,12 +64,19 @@ export default chart => {
58
64
)
59
65
: { min : Infinity , max : - Infinity }
60
66
61
- if ( dimMinMax . min === Infinity ) return
67
+ if ( dimMinMax . min === Infinity ) {
68
+ if ( typeof ymin === "undefined" || typeof ymax === "undefined" ) return
69
+
70
+ convert ( ymin , ymax )
71
+
72
+ return
73
+ }
62
74
63
75
convert ( dimMinMax . min , dimMinMax . max )
64
- } )
76
+ }
65
77
66
- const offYAxisChange = chart . on ( "yAxisChange" , convert )
78
+ const offVisibleDimensionsChanged = chart . on ( "visibleDimensionsChanged" , ( ) => onConvert ( ) )
79
+ const offYAxisChange = chart . on ( "yAxisChange" , onConvert )
67
80
68
81
return ( ) => {
69
82
offYAxisChange ( )
You can’t perform that action at this time.
0 commit comments