Java Code Examples for com.github.mikephil.charting.components.YAxis.AxisDependency

The following examples show how to use com.github.mikephil.charting.components.YAxis.AxisDependency. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: NetKnight   Source File: YAxisRenderer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
        return;

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 2
Source Project: android-kline   Source File: BarLineChartBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {

    // Saving current position of chart.
    mOnSizeChangedBuffer[0] = mOnSizeChangedBuffer[1] = 0;

    if (mKeepPositionOnRotation) {
        mOnSizeChangedBuffer[0] = mViewPortHandler.contentLeft();
        mOnSizeChangedBuffer[1] = mViewPortHandler.contentTop();
        getTransformer(AxisDependency.LEFT).pixelsToValue(mOnSizeChangedBuffer);
    }

    //Superclass transforms chart.
    super.onSizeChanged(w, h, oldw, oldh);

    if (mKeepPositionOnRotation) {

        //Restoring old position of chart.
        getTransformer(AxisDependency.LEFT).pointValuesToPixel(mOnSizeChangedBuffer);
        mViewPortHandler.centerViewPort(mOnSizeChangedBuffer, this);
    } else {
        mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(), this, true);
    }
}
 
Example 3
Source Project: Stayfit   Source File: BarLineChartBase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x-value and y-value animated.
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
        float xsInView = getXAxis().getValues().size() / mViewPortHandler.getScaleX();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler,
                xIndex - xsInView / 2f, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
Example 4
Source Project: iMoney   Source File: YAxisRenderer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
        return;

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 5
Source Project: StockChart-MPAndroidChart   Source File: HorizontalBarChart.java    License: MIT License 6 votes vote down vote up
/**
 * Returns a recyclable MPPointF instance.
 *
 * @param e
 * @param axis
 * @return
 */
@Override
public MPPointF getPosition(Entry e, AxisDependency axis) {

    if (e == null) {
        return null;
    }

    float[] vals = mGetPositionBuffer;
    vals[0] = e.getY();
    vals[1] = e.getX();

    getTransformer(axis).pointValuesToPixel(vals);

    return MPPointF.getInstance(vals[0], vals[1]);
}
 
Example 6
Source Project: StockChart-MPAndroidChart   Source File: ChartData.java    License: MIT License 6 votes vote down vote up
/**
 * Returns the maximum y-value for the specified axis.
 *
 * @param axis
 * @return
 */
public float getYMax(AxisDependency axis) {
    if (axis == AxisDependency.LEFT) {

        if (mLeftAxisMax == -Float.MAX_VALUE) {
            return mRightAxisMax;
        } else {
            return mLeftAxisMax;
        }
    } else {
        if (mRightAxisMax == -Float.MAX_VALUE) {
            return mLeftAxisMax;
        } else {
            return mRightAxisMax;
        }
    }
}
 
Example 7
Source Project: StockChart-MPAndroidChart   Source File: YAxisRenderer.java    License: MIT License 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled()) {
        return;
    }

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 8
Source Project: Stayfit   Source File: YAxisRenderer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
        return;

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
Example 9
Source Project: StockChart-MPAndroidChart   Source File: BarChartActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void onValueSelected(Entry e, Highlight h) {

    if (e == null)
        return;

    RectF bounds = onValueSelectedRectF;
    chart.getBarBounds((BarEntry) e, bounds);
    MPPointF position = chart.getPosition(e, AxisDependency.LEFT);

    Log.i("bounds", bounds.toString());
    Log.i("position", position.toString());

    Log.i("x-index",
            "low: " + chart.getLowestVisibleX() + ", high: "
                    + chart.getHighestVisibleX());

    MPPointF.recycleInstance(position);
}
 
Example 10
private LineDataSet createSet() {

        LineDataSet set = new LineDataSet(null, "Dynamic Data");
        set.setAxisDependency(AxisDependency.LEFT);
        set.setColor(ColorTemplate.getHoloBlue());
        set.setCircleColor(Color.WHITE);
        set.setLineWidth(2f);
        set.setCircleRadius(4f);
        set.setFillAlpha(65);
        set.setFillColor(ColorTemplate.getHoloBlue());
        set.setHighLightColor(Color.rgb(244, 117, 117));
        set.setValueTextColor(Color.WHITE);
        set.setValueTextSize(9f);
        set.setDrawValues(false);
        return set;
    }
 
Example 11
Source Project: Ticket-Analysis   Source File: ChartData.java    License: MIT License 6 votes vote down vote up
/**
 * Adjusts the minimum and maximum values based on the given DataSet.
 *
 * @param d
 */
protected void calcMinMax(T d) {

    if (mYMax < d.getYMax())
        mYMax = d.getYMax();
    if (mYMin > d.getYMin())
        mYMin = d.getYMin();

    if (mXMax < d.getXMax())
        mXMax = d.getXMax();
    if (mXMin > d.getXMin())
        mXMin = d.getXMin();

    if (d.getAxisDependency() == AxisDependency.LEFT) {

        if (mLeftAxisMax < d.getYMax())
            mLeftAxisMax = d.getYMax();
        if (mLeftAxisMin > d.getYMin())
            mLeftAxisMin = d.getYMin();
    } else {
        if (mRightAxisMax < d.getYMax())
            mRightAxisMax = d.getYMax();
        if (mRightAxisMin > d.getYMin())
            mRightAxisMin = d.getYMin();
    }
}
 
Example 12
Source Project: Ticket-Analysis   Source File: BarLineChartBase.java    License: MIT License 6 votes vote down vote up
/**
 * Zooms by the specified scale factor to the specified values on the specified axis.
 *
 * @param scaleX
 * @param scaleY
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration
 */
@TargetApi(11)
public void zoomAndCenterAnimated(float scaleX, float scaleY, float xValue, float yValue, AxisDependency axis,
                                  long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        MPPointD origin = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        Runnable job = AnimatedZoomJob.getInstance(mViewPortHandler, this, getTransformer(axis), getAxis(axis), mXAxis
                        .mAxisRange, scaleX, scaleY, mViewPortHandler.getScaleX(), mViewPortHandler.getScaleY(),
                xValue, yValue, (float) origin.x, (float) origin.y, duration);
        addViewportJob(job);

        MPPointD.recycleInstance(origin);

    } else {
        Log.e(LOG_TAG, "Unable to execute zoomAndCenterAnimated(...) on API level < 11");
    }
}
 
Example 13
Source Project: NetKnight   Source File: BarLineChartBase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This will move the left side of the current viewport to the specified x-position
 * and center the viewport to the specified y-position animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xIndex, float yValue, AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler, xIndex, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
Example 14
Source Project: NetKnight   Source File: BarLineChartBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        
    // Saving current position of chart.
    float[] pts = new float[2];
    if (mKeepPositionOnRotation) {
        pts[0] = mViewPortHandler.contentLeft();
        pts[1] = mViewPortHandler.contentTop();
        getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
    }

    //Superclass transforms chart.
    super.onSizeChanged(w, h, oldw, oldh);

    if (mKeepPositionOnRotation) {

        //Restoring old position of chart.
        getTransformer(AxisDependency.LEFT).pointValuesToPixel(pts);
        mViewPortHandler.centerViewPort(pts, this);
    } else {
        mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(), this, true);
    }
}
 
Example 15
Source Project: iMoney   Source File: Utils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the minimum distance from a touch-y-value (in pixels) to the
 * closest y-value (in pixels) that is displayed in the chart.
 * 
 * @param valsAtIndex
 * @param val
 * @param axis
 * @return
 */
public static float getMinimumDistance(List<SelectionDetail> valsAtIndex, float val,
        AxisDependency axis) {

    float distance = Float.MAX_VALUE;

    for (int i = 0; i < valsAtIndex.size(); i++) {

        SelectionDetail sel = valsAtIndex.get(i);

        if (sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs((float) sel.val - val);
            if (cdistance < distance) {
                distance = cdistance;
            }
        }
    }

    return distance;
}
 
Example 16
Source Project: Ticket-Analysis   Source File: BarLineChartBase.java    License: MIT License 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {

    // Saving current position of chart.
    mOnSizeChangedBuffer[0] = mOnSizeChangedBuffer[1] = 0;

    if (mKeepPositionOnRotation) {
        mOnSizeChangedBuffer[0] = mViewPortHandler.contentLeft();
        mOnSizeChangedBuffer[1] = mViewPortHandler.contentTop();
        getTransformer(AxisDependency.LEFT).pixelsToValue(mOnSizeChangedBuffer);
    }

    //Superclass transforms chart.
    super.onSizeChanged(w, h, oldw, oldh);

    if (mKeepPositionOnRotation) {

        //Restoring old position of chart.
        getTransformer(AxisDependency.LEFT).pointValuesToPixel(mOnSizeChangedBuffer);
        mViewPortHandler.centerViewPort(mOnSizeChangedBuffer, this);
    } else {
        mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(), this, true);
    }
}
 
Example 17
Source Project: android-kline   Source File: ChartData.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Adjusts the current minimum and maximum values based on the provided Entry object.
 *
 * @param e
 * @param axis
 */
protected void calcMinMax(Entry e, AxisDependency axis) {

    if (mYMax < e.getY())
        mYMax = e.getY();
    if (mYMin > e.getY())
        mYMin = e.getY();

    if (mXMax < e.getX())
        mXMax = e.getX();
    if (mXMin > e.getX())
        mXMin = e.getX();

    if (axis == AxisDependency.LEFT) {

        if (mLeftAxisMax < e.getY())
            mLeftAxisMax = e.getY();
        if (mLeftAxisMin > e.getY())
            mLeftAxisMin = e.getY();
    } else {
        if (mRightAxisMax < e.getY())
            mRightAxisMax = e.getY();
        if (mRightAxisMin > e.getY())
            mRightAxisMin = e.getY();
    }
}
 
Example 18
Source Project: Stayfit   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Transforms the given chart values into pixels. This is the opposite
 * method to getValuesByTouchPoint(...).
 *
 * @param x
 * @param y
 * @return
 */
public PointD getPixelsForValues(float x, float y, AxisDependency axis) {

    float[] pts = new float[]{
            x, y
    };

    getTransformer(axis).pointValuesToPixel(pts);

    return new PointD(pts[0], pts[1]);
}
 
Example 19
Source Project: android-kline   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the range of the specified axis.
 *
 * @param axis
 * @return
 */
protected float getAxisRange(AxisDependency axis) {
    if (axis == AxisDependency.LEFT)
        return mAxisLeft.mAxisRange;
    else
        return mAxisRight.mAxisRange;
}
 
Example 20
Source Project: StockChart-MPAndroidChart   Source File: BarLineChartBase.java    License: MIT License 5 votes vote down vote up
/**
 * Returns the Transformer class that contains all matrices and is
 * responsible for transforming values into pixels on the screen and
 * backwards.
 *
 * @return
 */
@Override
public Transformer getTransformer(AxisDependency which) {
    if (which == AxisDependency.LEFT) {
        return mLeftAxisTransformer;
    } else {
        return mRightAxisTransformer;
    }
}
 
Example 21
Source Project: NetKnight   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This will move the center of the current viewport to the specified
 * x-value and y-value.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xIndex
 * @param yValue
 * @param axis   - which axis should be used as a reference for the y-axis
 */
public void centerViewTo(float xIndex, float yValue, AxisDependency axis) {

    float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
    float xsInView = getXAxis().getValues().size() / mViewPortHandler.getScaleX();

    Runnable job = new MoveViewJob(mViewPortHandler,
            xIndex - xsInView / 2f, yValue + valsInView / 2f,
            getTransformer(axis), this);

    addViewportJob(job);
}
 
Example 22
Source Project: android-kline   Source File: ChartData.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the first DataSet from the datasets-array that has it's dependency on the right axis.
 * Returns null if no DataSet with right dependency could be found.
 *
 * @return
 */
public T getFirstRight(List<T> sets) {
    for (T dataSet : sets) {
        if (dataSet.getAxisDependency() == AxisDependency.RIGHT)
            return dataSet;
    }
    return null;
}
 
Example 23
Source Project: Ticket-Analysis   Source File: ChartData.java    License: MIT License 5 votes vote down vote up
/**
 * Returns the minimum y-value for the specified axis.
 *
 * @param axis
 * @return
 */
public float getYMin(AxisDependency axis) {
    if (axis == AxisDependency.LEFT) {

        if (mLeftAxisMin == Float.MAX_VALUE) {
            return mRightAxisMin;
        } else
            return mLeftAxisMin;
    } else {
        if (mRightAxisMin == Float.MAX_VALUE) {
            return mLeftAxisMin;
        } else
            return mRightAxisMin;
    }
}
 
Example 24
Source Project: android-kline   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void init() {
    super.init();

    mAxisLeft = new YAxis(AxisDependency.LEFT);
    mAxisRight = new YAxis(AxisDependency.RIGHT);

    mLeftAxisTransformer = new Transformer(mViewPortHandler);
    mRightAxisTransformer = new Transformer(mViewPortHandler);

    mAxisRendererLeft = new YAxisRenderer(mViewPortHandler, mAxisLeft, mLeftAxisTransformer);
    mAxisRendererRight = new YAxisRenderer(mViewPortHandler, mAxisRight, mRightAxisTransformer);

    mXAxisRenderer = new XAxisRenderer(mViewPortHandler, mXAxis, mLeftAxisTransformer);

    setHighlighter(new ChartHighlighter(this));

    mChartTouchListener = new BarLineChartTouchListener(this, mViewPortHandler.getMatrixTouch(), 3f);

    mGridBackgroundPaint = new Paint();
    mGridBackgroundPaint.setStyle(Style.FILL);
    // mGridBackgroundPaint.setColor(Color.WHITE);
    mGridBackgroundPaint.setColor(Color.rgb(240, 240, 240)); // light
    // grey

    mBorderPaint = new Paint();
    mBorderPaint.setStyle(Style.STROKE);
    mBorderPaint.setColor(Color.BLACK);
    mBorderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
}
 
Example 25
Source Project: Stayfit   Source File: RadarChart.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void calcMinMax() {
    super.calcMinMax();

    float minLeft = !Float.isNaN(mYAxis.getAxisMinValue())
            ? mYAxis.getAxisMinValue()
            : mData.getYMin(AxisDependency.LEFT);
    float maxLeft = !Float.isNaN(mYAxis.getAxisMaxValue())
            ? mYAxis.getAxisMaxValue()
            : mData.getYMax(AxisDependency.LEFT);

    mXChartMax = mData.getXVals().size() - 1;
    mDeltaX = Math.abs(mXChartMax - mXChartMin);

    float leftRange = Math.abs(maxLeft - minLeft);

    float topSpaceLeft = leftRange / 100f * mYAxis.getSpaceTop();
    float bottomSpaceLeft = leftRange / 100f * mYAxis.getSpaceBottom();

    mXChartMax = mData.getXVals().size() - 1;
    mDeltaX = Math.abs(mXChartMax - mXChartMin);

    // Use the values as they are
    mYAxis.mAxisMinimum = !Float.isNaN(mYAxis.getAxisMinValue())
            ? mYAxis.getAxisMinValue()
            : (minLeft - bottomSpaceLeft);
    mYAxis.mAxisMaximum = !Float.isNaN(mYAxis.getAxisMaxValue())
            ? mYAxis.getAxisMaxValue()
            : (maxLeft + topSpaceLeft);

    mYAxis.mAxisRange = Math.abs(mYAxis.mAxisMaximum - mYAxis.mAxisMinimum);
}
 
Example 26
Source Project: iMoney   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the lowest x-index (value on the x-axis) that is still visible on
 * the chart.
 * 
 * @return
 */
@Override
public int getLowestVisibleXIndex() {
    float[] pts = new float[] {
            mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom()
    };
    getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
    return (pts[0] <= 0) ? 0 : (int) (pts[0] + 1);
}
 
Example 27
Source Project: StockChart-MPAndroidChart   Source File: BarLineChartBase.java    License: MIT License 5 votes vote down vote up
/**
 * Returns the range of the specified axis.
 *
 * @param axis
 * @return
 */
protected float getAxisRange(AxisDependency axis) {
    if (axis == AxisDependency.LEFT) {
        return mAxisLeft.mAxisRange;
    } else {
        return mAxisRight.mAxisRange;
    }
}
 
Example 28
Source Project: iMoney   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Transforms the given chart values into pixels. This is the opposite
 * method to getValuesByTouchPoint(...).
 * 
 * @param x
 * @param y
 * @return
 */
public PointD getPixelsForValues(float x, float y, AxisDependency axis) {

    float[] pts = new float[] {
            x, y
    };

    getTransformer(axis).pointValuesToPixel(pts);

    return new PointD(pts[0], pts[1]);
}
 
Example 29
Source Project: iMoney   Source File: BarLineChartBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the delta-y value (y-value range) of the specified axis.
 * 
 * @param axis
 * @return
 */
public float getDeltaY(AxisDependency axis) {
    if (axis == AxisDependency.LEFT)
        return mAxisLeft.mAxisRange;
    else
        return mAxisRight.mAxisRange;
}
 
Example 30
Source Project: Stayfit   Source File: ChartData.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the first DataSet from the datasets-array that has it's dependency on the left axis.
 * Returns null if no DataSet with left dependency could be found.
 *
 * @return
 */
public T getFirstLeft() {
    for (T dataSet : mDataSets) {
        if (dataSet.getAxisDependency() == AxisDependency.LEFT)
            return dataSet;
    }

    return null;
}