@@ -157,6 +157,16 @@ export abstract class AxisBase extends ComponentBase {
157
157
*/
158
158
public mAxisMinimum = 0 ;
159
159
160
+ /**
161
+ * don't touch this direclty, use setter
162
+ */
163
+ public mAxisSuggestedMaximum = undefined ;
164
+
165
+ /**
166
+ * don't touch this directly, use setter
167
+ */
168
+ public mAxisSuggestedMinimum = undefined ;
169
+
160
170
/**
161
171
* the total range of values this axis covers
162
172
*/
@@ -714,6 +724,26 @@ export abstract class AxisBase extends ComponentBase {
714
724
this . mAxisRange = Math . abs ( this . mAxisMaximum - min ) ;
715
725
}
716
726
727
+ /**
728
+ * Set a suggested minimum value for this axis. If set, this will be used
729
+ * as minimum is no value is smaller than it.
730
+ *
731
+ * @param min
732
+ */
733
+ public setSuggestedAxisMinimum ( min ) {
734
+ this . mAxisSuggestedMinimum = min ;
735
+ }
736
+
737
+ /**
738
+ * Set a suggested maximum value for this axis. If set, this will be used
739
+ * as maximum is no value is greater than it.
740
+ *
741
+ * @param min
742
+ */
743
+ public setSuggestedAxisMaximum ( max ) {
744
+ this . mAxisSuggestedMaximum = max ;
745
+ }
746
+
717
747
/**
718
748
* Use setAxisMinimum(...) instead.
719
749
*
@@ -758,7 +788,12 @@ export abstract class AxisBase extends ComponentBase {
758
788
// if custom, use value as is, else use data value
759
789
let min = this . mCustomAxisMin ? this . mAxisMinimum : dataMin - this . mSpaceMin ;
760
790
let max = this . mCustomAxisMax ? this . mAxisMaximum : dataMax + this . mSpaceMax ;
761
-
791
+ if ( this . mAxisSuggestedMinimum !== undefined ) {
792
+ min = Math . min ( min , this . mAxisSuggestedMinimum ) ;
793
+ }
794
+ if ( this . mAxisSuggestedMaximum !== undefined ) {
795
+ max = Math . max ( max , this . mAxisSuggestedMaximum ) ;
796
+ }
762
797
// temporary range (before calculations)
763
798
const range = Math . abs ( max - min ) ;
764
799
0 commit comments