@@ -112,6 +112,16 @@ public abstract class AxisBase extends ComponentBase {
112112 */
113113 protected boolean mDrawLimitLineBehindData = false ;
114114
115+ /**
116+ * Extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
117+ */
118+ protected float mSpaceMin = 0.f ;
119+
120+ /**
121+ * Extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
122+ */
123+ protected float mSpaceMax = 0.f ;
124+
115125 /**
116126 * flag indicating that the axis-min value has been customized
117127 */
@@ -705,8 +715,8 @@ public void setAxisMaxValue(float max) {
705715 public void calculate (float dataMin , float dataMax ) {
706716
707717 // if custom, use value as is, else use data value
708- float min = mCustomAxisMin ? mAxisMinimum : dataMin ;
709- float max = mCustomAxisMax ? mAxisMaximum : dataMax ;
718+ float min = mCustomAxisMin ? mAxisMinimum : ( dataMin - mSpaceMin ) ;
719+ float max = mCustomAxisMax ? mAxisMaximum : ( dataMax + mSpaceMax ) ;
710720
711721 // temporary range (before calculations)
712722 float range = Math .abs (max - min );
@@ -723,4 +733,36 @@ public void calculate(float dataMin, float dataMax) {
723733 // actual range
724734 this .mAxisRange = Math .abs (max - min );
725735 }
736+
737+ /**
738+ * Gets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
739+ */
740+ public float getSpaceMin ()
741+ {
742+ return mSpaceMin ;
743+ }
744+
745+ /**
746+ * Sets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
747+ */
748+ public void setSpaceMin (float mSpaceMin )
749+ {
750+ this .mSpaceMin = mSpaceMin ;
751+ }
752+
753+ /**
754+ * Gets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
755+ */
756+ public float getSpaceMax ()
757+ {
758+ return mSpaceMax ;
759+ }
760+
761+ /**
762+ * Sets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
763+ */
764+ public void setSpaceMax (float mSpaceMax )
765+ {
766+ this .mSpaceMax = mSpaceMax ;
767+ }
726768}
0 commit comments