Java Code Examples for com.github.mikephil.charting.interfaces.datasets.ILineDataSet#getCircleColorCount()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.ILineDataSet#getCircleColorCount() . 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 File: LineChartRenderer.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
/**
 * Sets up the cache, returns true if a change of cache was required.
 *
 * @param set
 * @return
 */
public boolean init(ILineDataSet set) {

    int size = set.getCircleColorCount();
    boolean changeRequired = false;

    if (circleBitmaps == null) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    } else if (circleBitmaps.length != size) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    }

    return changeRequired;
}
 
Example 2
Source File: LineChartRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
/**
 * Sets up the cache, returns true if a change of cache was required.
 *
 * @param set
 * @return
 */
protected boolean init(ILineDataSet set) {

    int size = set.getCircleColorCount();
    boolean changeRequired = false;

    if (circleBitmaps == null) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    } else if (circleBitmaps.length != size) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    }

    return changeRequired;
}
 
Example 3
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the cache, returns true if a change of cache was required.
 *
 * @param set
 * @return
 */
protected boolean init(ILineDataSet set) {

    int size = set.getCircleColorCount();
    boolean changeRequired = false;

    if (circleBitmaps == null) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    } else if (circleBitmaps.length != size) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    }

    return changeRequired;
}
 
Example 4
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the cache, returns true if a change of cache was required.
 *
 * @param set
 * @return
 */
protected boolean init(ILineDataSet set) {

    int size = set.getCircleColorCount();
    boolean changeRequired = false;

    if (circleBitmaps == null) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    } else if (circleBitmaps.length != size) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    }

    return changeRequired;
}
 
Example 5
Source File: LineChartRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
/**
 * Fills the cache with bitmaps for the given dataset.
 *
 * @param set
 * @param drawCircleHole
 * @param drawTransparentCircleHole
 */
public void fill(ILineDataSet set, boolean drawCircleHole, boolean drawTransparentCircleHole) {

    int colorCount = set.getCircleColorCount();
    float circleRadius = set.getCircleRadius();
    float circleHoleRadius = set.getCircleHoleRadius();

    for (int i = 0; i < colorCount; i++) {

        Bitmap.Config conf = Bitmap.Config.ARGB_4444;
        Bitmap circleBitmap = Bitmap.createBitmap((int) (circleRadius * 2.1), (int) (circleRadius * 2.1), conf);

        Canvas canvas = new Canvas(circleBitmap);
        circleBitmaps[i] = circleBitmap;
        mRenderPaint.setColor(set.getCircleColor(i));

        if (drawTransparentCircleHole) {
            // Begin path for circle with hole
            mCirclePathBuffer.reset();

            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    Path.Direction.CW);

            // Cut hole in path
            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleHoleRadius,
                    Path.Direction.CCW);

            // Fill in-between
            canvas.drawPath(mCirclePathBuffer, mRenderPaint);
        } else {

            canvas.drawCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    mRenderPaint);

            if (drawCircleHole) {
                canvas.drawCircle(
                        circleRadius,
                        circleRadius,
                        circleHoleRadius,
                        mCirclePaintInner);
            }
        }
    }
}
 
Example 6
Source File: LineChartRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
/**
 * Fills the cache with bitmaps for the given dataset.
 *
 * @param set
 * @param drawCircleHole
 * @param drawTransparentCircleHole
 */
protected void fill(ILineDataSet set, boolean drawCircleHole, boolean drawTransparentCircleHole) {

    int colorCount = set.getCircleColorCount();
    float circleRadius = set.getCircleRadius();
    float circleHoleRadius = set.getCircleHoleRadius();

    for (int i = 0; i < colorCount; i++) {

        Bitmap.Config conf = Bitmap.Config.ARGB_4444;
        Bitmap circleBitmap = Bitmap.createBitmap((int) (circleRadius * 2.1), (int) (circleRadius * 2.1), conf);

        Canvas canvas = new Canvas(circleBitmap);
        circleBitmaps[i] = circleBitmap;
        mRenderPaint.setColor(set.getCircleColor(i));

        if (drawTransparentCircleHole) {
            // Begin path for circle with hole
            mCirclePathBuffer.reset();

            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    Path.Direction.CW);

            // Cut hole in path
            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleHoleRadius,
                    Path.Direction.CCW);

            // Fill in-between
            canvas.drawPath(mCirclePathBuffer, mRenderPaint);
        } else {

            canvas.drawCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    mRenderPaint);

            if (drawCircleHole) {
                canvas.drawCircle(
                        circleRadius,
                        circleRadius,
                        circleHoleRadius,
                        mCirclePaintInner);
            }
        }
    }
}
 
Example 7
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
/**
 * Fills the cache with bitmaps for the given dataset.
 *
 * @param set
 * @param drawCircleHole
 * @param drawTransparentCircleHole
 */
protected void fill(ILineDataSet set, boolean drawCircleHole, boolean drawTransparentCircleHole) {

    int colorCount = set.getCircleColorCount();
    float circleRadius = set.getCircleRadius();
    float circleHoleRadius = set.getCircleHoleRadius();

    for (int i = 0; i < colorCount; i++) {

        Bitmap.Config conf = Bitmap.Config.ARGB_4444;
        Bitmap circleBitmap = Bitmap.createBitmap((int) (circleRadius * 2.1), (int) (circleRadius * 2.1), conf);

        Canvas canvas = new Canvas(circleBitmap);
        circleBitmaps[i] = circleBitmap;
        mRenderPaint.setColor(set.getCircleColor(i));

        if (drawTransparentCircleHole) {
            // Begin path for circle with hole
            mCirclePathBuffer.reset();

            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    Path.Direction.CW);

            // Cut hole in path
            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleHoleRadius,
                    Path.Direction.CCW);

            // Fill in-between
            canvas.drawPath(mCirclePathBuffer, mRenderPaint);
        } else {

            canvas.drawCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    mRenderPaint);

            if (drawCircleHole) {
                canvas.drawCircle(
                        circleRadius,
                        circleRadius,
                        circleHoleRadius,
                        mCirclePaintInner);
            }
        }
    }
}
 
Example 8
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
/**
 * Fills the cache with bitmaps for the given dataset.
 *
 * @param set
 * @param drawCircleHole
 * @param drawTransparentCircleHole
 */
protected void fill(ILineDataSet set, boolean drawCircleHole, boolean drawTransparentCircleHole) {

    int colorCount = set.getCircleColorCount();
    float circleRadius = set.getCircleRadius();
    float circleHoleRadius = set.getCircleHoleRadius();

    for (int i = 0; i < colorCount; i++) {

        Bitmap.Config conf = Bitmap.Config.ARGB_4444;
        Bitmap circleBitmap = Bitmap.createBitmap((int) (circleRadius * 2.1), (int) (circleRadius * 2.1), conf);

        Canvas canvas = new Canvas(circleBitmap);
        circleBitmaps[i] = circleBitmap;
        mRenderPaint.setColor(set.getCircleColor(i));

        if (drawTransparentCircleHole) {
            // Begin path for circle with hole
            mCirclePathBuffer.reset();

            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    Path.Direction.CW);

            // Cut hole in path
            mCirclePathBuffer.addCircle(
                    circleRadius,
                    circleRadius,
                    circleHoleRadius,
                    Path.Direction.CCW);

            // Fill in-between
            canvas.drawPath(mCirclePathBuffer, mRenderPaint);
        } else {

            canvas.drawCircle(
                    circleRadius,
                    circleRadius,
                    circleRadius,
                    mRenderPaint);

            if (drawCircleHole) {
                canvas.drawCircle(
                        circleRadius,
                        circleRadius,
                        circleHoleRadius,
                        mCirclePaintInner);
            }
        }
    }
}