@@ -311,6 +311,13 @@ protected void calcMinMax() {
311311
312312 float leftRange = Math .abs (maxLeft - (mAxisLeft .isStartAtZeroEnabled () ? 0 : minLeft ));
313313 float rightRange = Math .abs (maxRight - (mAxisRight .isStartAtZeroEnabled () ? 0 : minRight ));
314+
315+ // in case all values are equal
316+ if (leftRange == 0f )
317+ maxLeft = maxLeft + 1f ;
318+
319+ if (rightRange == 0f )
320+ maxRight = maxRight + 1f ;
314321
315322 float topSpaceLeft = leftRange / 100f * mAxisLeft .getSpaceTop ();
316323 float topSpaceRight = rightRange / 100f * mAxisRight .getSpaceTop ();
@@ -356,7 +363,7 @@ protected void calculateOffsets() {
356363 offsetRight += mLegend .mTextWidthMax + mLegend .getXOffset () * 2f ;
357364
358365 } else if (mLegend .getPosition () == LegendPosition .LEFT_OF_CHART
359- || mLegend .getPosition () == LegendPosition .LEFT_OF_CHART_CENTER ) {
366+ || mLegend .getPosition () == LegendPosition .LEFT_OF_CHART_CENTER ) {
360367
361368 offsetLeft += mLegend .mTextWidthMax + mLegend .getXOffset () * 2f ;
362369
@@ -370,11 +377,13 @@ protected void calculateOffsets() {
370377
371378 // offsets for y-labels
372379 if (mAxisLeft .needsOffset ()) {
373- offsetLeft += mAxisLeft .getRequiredWidthSpace (mAxisRendererLeft .getPaintAxisLabels ());
380+ offsetLeft += mAxisLeft .getRequiredWidthSpace (mAxisRendererLeft
381+ .getPaintAxisLabels ());
374382 }
375383
376384 if (mAxisRight .needsOffset ()) {
377- offsetRight += mAxisRight .getRequiredWidthSpace (mAxisRendererRight .getPaintAxisLabels ());
385+ offsetRight += mAxisRight .getRequiredWidthSpace (mAxisRendererRight
386+ .getPaintAxisLabels ());
378387 }
379388
380389 float xlabelheight = mXAxis .mLabelHeight * 2f ;
0 commit comments