com.github.mikephil.charting.renderer.scatter.IShapeRenderer Java Examples

The following examples show how to use com.github.mikephil.charting.renderer.scatter.IShapeRenderer. 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: RealmScatterDataSet.java    From MPAndroidChart-Realm with Apache License 2.0 6 votes vote down vote up
public static IShapeRenderer getRendererForShape(ScatterChart.ScatterShape shape) {

        switch (shape) {
            case SQUARE:
                return new SquareShapeRenderer();
            case CIRCLE:
                return new CircleShapeRenderer();
            case TRIANGLE:
                return new TriangleShapeRenderer();
            case CROSS:
                return new CrossShapeRenderer();
            case X:
                return new XShapeRenderer();
            case CHEVRON_UP:
                return new ChevronUpShapeRenderer();
            case CHEVRON_DOWN:
                return new ChevronDownShapeRenderer();
        }

        return null;
    }
 
Example #2
Source File: ScatterDataSet.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
public static IShapeRenderer getRendererForShape(ScatterChart.ScatterShape shape) {

        switch (shape) {
            case SQUARE:
                return new SquareShapeRenderer();
            case CIRCLE:
                return new CircleShapeRenderer();
            case TRIANGLE:
                return new TriangleShapeRenderer();
            case CROSS:
                return new CrossShapeRenderer();
            case X:
                return new XShapeRenderer();
            case CHEVRON_UP:
                return new ChevronUpShapeRenderer();
            case CHEVRON_DOWN:
                return new ChevronDownShapeRenderer();
        }

        return null;
    }
 
Example #3
Source File: ScatterDataSet.java    From android-kline with Apache License 2.0 5 votes vote down vote up
public static IShapeRenderer getRendererForShape(ScatterChart.ScatterShape shape) {

        switch (shape) {
            case SQUARE: return new SquareShapeRenderer();
            case CIRCLE: return new CircleShapeRenderer();
            case TRIANGLE: return new TriangleShapeRenderer();
            case CROSS: return new CrossShapeRenderer();
            case X: return new XShapeRenderer();
            case CHEVRON_UP: return new ChevronUpShapeRenderer();
            case CHEVRON_DOWN: return new ChevronDownShapeRenderer();
        }

        return null;
    }
 
Example #4
Source File: ScatterDataSet.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
public static IShapeRenderer getRendererForShape(ScatterChart.ScatterShape shape) {

        switch (shape) {
            case SQUARE: return new SquareShapeRenderer();
            case CIRCLE: return new CircleShapeRenderer();
            case TRIANGLE: return new TriangleShapeRenderer();
            case CROSS: return new CrossShapeRenderer();
            case X: return new XShapeRenderer();
            case CHEVRON_UP: return new ChevronUpShapeRenderer();
            case CHEVRON_DOWN: return new ChevronDownShapeRenderer();
        }

        return null;
    }
 
Example #5
Source File: ScatterDataSet.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public IShapeRenderer getShapeRenderer() {
    return mShapeRenderer;
}
 
Example #6
Source File: RealmScatterDataSet.java    From MPAndroidChart-Realm with Apache License 2.0 4 votes vote down vote up
@Override
public IShapeRenderer getShapeRenderer() {
    return mShapeRenderer;
}
 
Example #7
Source File: ScatterChartRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

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

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
Example #8
Source File: ScatterChartRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

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

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
Example #9
Source File: ScatterDataSet.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public IShapeRenderer getShapeRenderer() {
    return mShapeRenderer;
}
 
Example #10
Source File: ScatterChartRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

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

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
Example #11
Source File: ScatterDataSet.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public IShapeRenderer getShapeRenderer() {
    return mShapeRenderer;
}
 
Example #12
Source File: ScatterChartRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        if (dataSet.getEntryCount() < 1)
            return;

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

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

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
Example #13
Source File: IScatterDataSet.java    From Ticket-Analysis with MIT License 2 votes vote down vote up
/**
 * Returns the IShapeRenderer responsible for rendering this DataSet.
 *
 * @return
 */
IShapeRenderer getShapeRenderer();
 
Example #14
Source File: ScatterDataSet.java    From android-kline with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a new IShapeRenderer responsible for drawing this DataSet.
 * This can also be used to set a custom IShapeRenderer aside from the default ones.
 *
 * @param shapeRenderer
 */
public void setShapeRenderer(IShapeRenderer shapeRenderer) {
    mShapeRenderer = shapeRenderer;
}
 
Example #15
Source File: ScatterDataSet.java    From Ticket-Analysis with MIT License 2 votes vote down vote up
/**
 * Sets a new IShapeRenderer responsible for drawing this DataSet.
 * This can also be used to set a custom IShapeRenderer aside from the default ones.
 *
 * @param shapeRenderer
 */
public void setShapeRenderer(IShapeRenderer shapeRenderer) {
    mShapeRenderer = shapeRenderer;
}
 
Example #16
Source File: IScatterDataSet.java    From android-kline with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the IShapeRenderer responsible for rendering this DataSet.
 *
 * @return
 */
IShapeRenderer getShapeRenderer();
 
Example #17
Source File: IScatterDataSet.java    From StockChart-MPAndroidChart with MIT License 2 votes vote down vote up
/**
 * Returns the IShapeRenderer responsible for rendering this DataSet.
 *
 * @return
 */
IShapeRenderer getShapeRenderer();
 
Example #18
Source File: RealmScatterDataSet.java    From MPAndroidChart-Realm with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a new IShapeRenderer responsible for drawing this DataSet.
 * This can also be used to set a custom IShapeRenderer aside from the default ones.
 *
 * @param shapeRenderer
 */
public void setShapeRenderer(IShapeRenderer shapeRenderer) {
    mShapeRenderer = shapeRenderer;
}
 
Example #19
Source File: ScatterDataSet.java    From StockChart-MPAndroidChart with MIT License 2 votes vote down vote up
/**
 * Sets a new IShapeRenderer responsible for drawing this DataSet.
 * This can also be used to set a custom IShapeRenderer aside from the default ones.
 *
 * @param shapeRenderer
 */
public void setShapeRenderer(IShapeRenderer shapeRenderer) {
    mShapeRenderer = shapeRenderer;
}