@@ -194,17 +194,19 @@ protected void onDraw(Canvas canvas) {
194194 // execute all drawing commands
195195 drawGridBackground (canvas );
196196
197+ if (mAutoScaleMinMaxEnabled ) {
198+ autoScale ();
199+ }
200+
197201 if (mAxisLeft .isEnabled ())
198202 mAxisRendererLeft .computeAxis (mAxisLeft .mAxisMinimum , mAxisLeft .mAxisMaximum , mAxisLeft .isInverted ());
203+
199204 if (mAxisRight .isEnabled ())
200205 mAxisRendererRight .computeAxis (mAxisRight .mAxisMinimum , mAxisRight .mAxisMaximum , mAxisRight .isInverted ());
206+
201207 if (mXAxis .isEnabled ())
202208 mXAxisRenderer .computeAxis (mXAxis .mAxisMinimum , mXAxis .mAxisMaximum , false );
203209
204- if (mAutoScaleMinMaxEnabled ) {
205- autoScale ();
206- }
207-
208210 mXAxisRenderer .renderAxisLine (canvas );
209211 mAxisRendererLeft .renderAxisLine (canvas );
210212 mAxisRendererRight .renderAxisLine (canvas );
@@ -213,13 +215,13 @@ protected void onDraw(Canvas canvas) {
213215 mAxisRendererLeft .renderGridLines (canvas );
214216 mAxisRendererRight .renderGridLines (canvas );
215217
216- if (mXAxis .isDrawLimitLinesBehindDataEnabled ())
218+ if (mXAxis .isEnabled () && mXAxis . isDrawLimitLinesBehindDataEnabled ())
217219 mXAxisRenderer .renderLimitLines (canvas );
218220
219- if (mAxisLeft .isDrawLimitLinesBehindDataEnabled ())
221+ if (mAxisLeft .isEnabled () && mAxisLeft . isDrawLimitLinesBehindDataEnabled ())
220222 mAxisRendererLeft .renderLimitLines (canvas );
221223
222- if (mAxisRight .isDrawLimitLinesBehindDataEnabled ())
224+ if (mAxisRight .isEnabled () && mAxisRight . isDrawLimitLinesBehindDataEnabled ())
223225 mAxisRendererRight .renderLimitLines (canvas );
224226
225227 // make sure the data cannot be drawn outside the content-rect
@@ -237,13 +239,13 @@ protected void onDraw(Canvas canvas) {
237239
238240 mRenderer .drawExtras (canvas );
239241
240- if (!mXAxis .isDrawLimitLinesBehindDataEnabled ())
242+ if (mXAxis . isEnabled () && !mXAxis .isDrawLimitLinesBehindDataEnabled ())
241243 mXAxisRenderer .renderLimitLines (canvas );
242244
243- if (!mAxisLeft .isDrawLimitLinesBehindDataEnabled ())
245+ if (mAxisLeft . isEnabled () && !mAxisLeft .isDrawLimitLinesBehindDataEnabled ())
244246 mAxisRendererLeft .renderLimitLines (canvas );
245247
246- if (!mAxisRight .isDrawLimitLinesBehindDataEnabled ())
248+ if (mAxisRight . isEnabled () && !mAxisRight .isDrawLimitLinesBehindDataEnabled ())
247249 mAxisRendererRight .renderLimitLines (canvas );
248250
249251 mXAxisRenderer .renderAxisLabels (canvas );
@@ -347,9 +349,14 @@ protected void autoScale() {
347349 mXAxis .calculate (mData .getXMin (), mData .getXMax ());
348350
349351 // calculate axis range (min / max) according to provided data
350- mAxisLeft .calculate (mData .getYMin (AxisDependency .LEFT ), mData .getYMax (AxisDependency .LEFT ));
351- mAxisRight .calculate (mData .getYMin (AxisDependency .RIGHT ), mData .getYMax (AxisDependency
352- .RIGHT ));
352+
353+ if (mAxisLeft .isEnabled ())
354+ mAxisLeft .calculate (mData .getYMin (AxisDependency .LEFT ),
355+ mData .getYMax (AxisDependency .LEFT ));
356+
357+ if (mAxisRight .isEnabled ())
358+ mAxisRight .calculate (mData .getYMin (AxisDependency .RIGHT ),
359+ mData .getYMax (AxisDependency .RIGHT ));
353360
354361 calculateOffsets ();
355362 }
0 commit comments