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 => {
4242 } )
4343 }
4444
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+
4652 const result = chart . getPayload ( )
4753
4854 const dimMinMax = result ?. byDimension
@@ -58,12 +64,19 @@ export default chart => {
5864 )
5965 : { min : Infinity , max : - Infinity }
6066
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+ }
6274
6375 convert ( dimMinMax . min , dimMinMax . max )
64- } )
76+ }
6577
66- const offYAxisChange = chart . on ( "yAxisChange" , convert )
78+ const offVisibleDimensionsChanged = chart . on ( "visibleDimensionsChanged" , ( ) => onConvert ( ) )
79+ const offYAxisChange = chart . on ( "yAxisChange" , onConvert )
6780
6881 return ( ) => {
6982 offYAxisChange ( )
You can’t perform that action at this time.
0 commit comments