@@ -36,11 +36,11 @@ const supplyLayoutPlotProps = (props, context) => {
36
36
} ) ;
37
37
} ;
38
38
39
- export const BoxWidth = connectLayoutToPlot (
39
+ export const LayoutNumericFractionInverse = connectLayoutToPlot (
40
40
connectToContainer ( NumericNoArrows , {
41
41
supplyPlotProps : supplyLayoutPlotProps ,
42
42
modifyPlotProps : ( props , context , plotProps ) => {
43
- const { fullValue, updatePlot} = plotProps ;
43
+ const { attrMeta , fullValue, updatePlot} = plotProps ;
44
44
plotProps . fullValue = ( ) => {
45
45
let fv = fullValue ( ) ;
46
46
if ( isNumeric ( fv ) ) {
@@ -57,16 +57,25 @@ export const BoxWidth = connectLayoutToPlot(
57
57
}
58
58
} ;
59
59
60
- plotProps . max = 100 ;
60
+ // Also take the inverse of max and min.
61
+ if ( attrMeta ) {
62
+ if ( isNumeric ( attrMeta . min ) ) {
63
+ plotProps . max = ( 1 - attrMeta . min ) * 100 ;
64
+ }
65
+
66
+ if ( isNumeric ( attrMeta . max ) ) {
67
+ plotProps . min = ( 1 - attrMeta . max ) * 100 ;
68
+ }
69
+ }
61
70
} ,
62
71
} )
63
72
) ;
64
73
65
- export const BoxPad = connectLayoutToPlot (
74
+ export const LayoutNumericFraction = connectLayoutToPlot (
66
75
connectToContainer ( NumericNoArrows , {
67
76
supplyPlotProps : supplyLayoutPlotProps ,
68
77
modifyPlotProps : ( props , context , plotProps ) => {
69
- const { fullValue, updatePlot} = plotProps ;
78
+ const { attrMeta , fullValue, updatePlot} = plotProps ;
70
79
plotProps . fullValue = ( ) => {
71
80
let fv = fullValue ( ) ;
72
81
if ( isNumeric ( fv ) ) {
@@ -83,7 +92,15 @@ export const BoxPad = connectLayoutToPlot(
83
92
}
84
93
} ;
85
94
86
- plotProps . max = 100 ;
95
+ if ( attrMeta ) {
96
+ if ( isNumeric ( attrMeta . max ) ) {
97
+ plotProps . max = attrMeta . max * 100 ;
98
+ }
99
+
100
+ if ( isNumeric ( attrMeta . max ) ) {
101
+ plotProps . min = attrMeta . min * 100 ;
102
+ }
103
+ }
87
104
} ,
88
105
} )
89
106
) ;
0 commit comments