Skip to content

Commit

Permalink
Consider axis dependency in Combined chart
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Jan 22, 2020
1 parent 6ebf3fa commit 1987d7e
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import android.util.Log;

import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet;

Expand Down Expand Up @@ -91,18 +92,26 @@ public void calcMinMax() {
if (data.getXMin() < mXMin)
mXMin = data.getXMin();

if (data.mLeftAxisMax > mLeftAxisMax)
mLeftAxisMax = data.mLeftAxisMax;

if (data.mLeftAxisMin < mLeftAxisMin)
mLeftAxisMin = data.mLeftAxisMin;

if (data.mRightAxisMax > mRightAxisMax)
mRightAxisMax = data.mRightAxisMax;

if (data.mRightAxisMin < mRightAxisMin)
mRightAxisMin = data.mRightAxisMin;

for (IBarLineScatterCandleBubbleDataSet<? extends Entry> dataset : sets) {
if (dataset.getAxisDependency() == YAxis.AxisDependency.LEFT) {
if (dataset.getYMax() > mLeftAxisMax) {
mLeftAxisMax = dataset.getYMax();
}

if (dataset.getYMin() < mLeftAxisMin) {
mLeftAxisMin = dataset.getYMin();
}
}
else {
if (dataset.getYMax() > mRightAxisMax) {
mRightAxisMax = dataset.getYMax();
}

if (dataset.getYMin() < mRightAxisMin) {
mRightAxisMin = dataset.getYMin();
}
}
}
}
}

Expand Down

0 comments on commit 1987d7e

Please sign in to comment.