Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IScatterDataSet#getScatterShapeSize()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IScatterDataSet#getScatterShapeSize() . 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: XShapeRenderer.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
    c.drawLine(
            posX + shapeHalf,
            posY - shapeHalf,
            posX - shapeHalf,
            posY + shapeHalf,
            renderPaint);

}
 
Example 2
Source File: XShapeRenderer.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
    c.drawLine(
            posX + shapeHalf,
            posY - shapeHalf,
            posX - shapeHalf,
            posY + shapeHalf,
            renderPaint);

}
 
Example 3
Source File: ChevronDownShapeRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                 float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX + (2 * shapeHalf),
            posY,
            renderPaint);

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX - (2 * shapeHalf),
            posY,
            renderPaint);
}
 
Example 4
Source File: ChevronUpShapeRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX,
            posY - (2 * shapeHalf),
            posX + (2 * shapeHalf),
            posY,
            renderPaint);

    c.drawLine(
            posX,
            posY - (2 * shapeHalf),
            posX - (2 * shapeHalf),
            posY,
            renderPaint);

}
 
Example 5
Source File: CrossShapeRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY,
            posX + shapeHalf,
            posY,
            renderPaint);
    c.drawLine(
            posX,
            posY - shapeHalf,
            posX,
            posY + shapeHalf,
            renderPaint);

}
 
Example 6
Source File: XShapeRenderer.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
    c.drawLine(
            posX + shapeHalf,
            posY - shapeHalf,
            posX - shapeHalf,
            posY + shapeHalf,
            renderPaint);

}
 
Example 7
Source File: ChevronDownShapeRenderer.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX + (2 * shapeHalf),
            posY,
            renderPaint);

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX - (2 * shapeHalf),
            posY,
            renderPaint);
}
 
Example 8
Source File: CrossShapeRenderer.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY,
            posX + shapeHalf,
            posY,
            renderPaint);
    c.drawLine(
            posX,
            posY - shapeHalf,
            posX,
            posY + shapeHalf,
            renderPaint);

}
 
Example 9
Source File: CustomScatterShapeRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
}
 
Example 10
Source File: ScatterData.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Returns the maximum shape-size across all DataSets.
 *
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

    return max;
}
 
Example 11
Source File: ScatterData.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the maximum shape-size across all DataSets.
 *
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

    return max;
}
 
Example 12
Source File: ScatterData.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Returns the maximum shape-size across all DataSets.
 *
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

    return max;
}
 
Example 13
Source File: ScatterData.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the maximum shape-size across all DataSets.
 * 
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

    return max;
}
 
Example 14
Source File: TriangleShapeRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    renderPaint.setStyle(Paint.Style.FILL);

    // create a triangle path
    Path tri = mTrianglePathBuffer;
    tri.reset();

    tri.moveTo(posX, posY - shapeHalf);
    tri.lineTo(posX + shapeHalf, posY + shapeHalf);
    tri.lineTo(posX - shapeHalf, posY + shapeHalf);

    if (shapeSize > 0.0) {
        tri.lineTo(posX, posY - shapeHalf);

        tri.moveTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX + shapeHalf - shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX,
                posY - shapeHalf + shapeStrokeSize);
        tri.lineTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
    }

    tri.close();

    c.drawPath(tri, renderPaint);
    tri.reset();

    if (shapeSize > 0.0 &&
            shapeHoleColor != ColorTemplate.COLOR_NONE) {

        renderPaint.setColor(shapeHoleColor);

        tri.moveTo(posX,
                posY - shapeHalf + shapeStrokeSize);
        tri.lineTo(posX + shapeHalf - shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.close();

        c.drawPath(tri, renderPaint);
        tri.reset();
    }

}
 
Example 15
Source File: SquareShapeRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    if (shapeSize > 0.0) {
        renderPaint.setStyle(Paint.Style.STROKE);
        renderPaint.setStrokeWidth(shapeStrokeSize);

        c.drawRect(posX - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posY - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posX + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                posY + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                renderPaint);

        if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
            renderPaint.setStyle(Paint.Style.FILL);

            renderPaint.setColor(shapeHoleColor);
            c.drawRect(posX - shapeHoleSizeHalf,
                    posY - shapeHoleSizeHalf,
                    posX + shapeHoleSizeHalf,
                    posY + shapeHoleSizeHalf,
                    renderPaint);
        }

    } else {
        renderPaint.setStyle(Paint.Style.FILL);

        c.drawRect(posX - shapeHalf,
                posY - shapeHalf,
                posX + shapeHalf,
                posY + shapeHalf,
                renderPaint);
    }
}
 
Example 16
Source File: CircleShapeRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    if (shapeSize > 0.0) {
        renderPaint.setStyle(Paint.Style.STROKE);
        renderPaint.setStrokeWidth(shapeStrokeSize);

        c.drawCircle(
                posX,
                posY,
                shapeHoleSizeHalf + shapeStrokeSizeHalf,
                renderPaint);

        if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
            renderPaint.setStyle(Paint.Style.FILL);

            renderPaint.setColor(shapeHoleColor);
            c.drawCircle(
                    posX,
                    posY,
                    shapeHoleSizeHalf,
                    renderPaint);
        }
    } else {
        renderPaint.setStyle(Paint.Style.FILL);

        c.drawCircle(
                posX,
                posY,
                shapeHalf,
                renderPaint);
    }

}
 
Example 17
Source File: SquareShapeRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    if (shapeSize > 0.0) {
        renderPaint.setStyle(Paint.Style.STROKE);
        renderPaint.setStrokeWidth(shapeStrokeSize);

        c.drawRect(posX - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posY - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posX + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                posY + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                renderPaint);

        if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
            renderPaint.setStyle(Paint.Style.FILL);

            renderPaint.setColor(shapeHoleColor);
            c.drawRect(posX - shapeHoleSizeHalf,
                    posY - shapeHoleSizeHalf,
                    posX + shapeHoleSizeHalf,
                    posY + shapeHoleSizeHalf,
                    renderPaint);
        }

    } else {
        renderPaint.setStyle(Paint.Style.FILL);

        c.drawRect(posX - shapeHalf,
                posY - shapeHalf,
                posX + shapeHalf,
                posY + shapeHalf,
                renderPaint);
    }
}
 
Example 18
Source File: TriangleShapeRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    renderPaint.setStyle(Paint.Style.FILL);

    // create a triangle path
    Path tri = mTrianglePathBuffer;
    tri.reset();

    tri.moveTo(posX, posY - shapeHalf);
    tri.lineTo(posX + shapeHalf, posY + shapeHalf);
    tri.lineTo(posX - shapeHalf, posY + shapeHalf);

    if (shapeSize > 0.0) {
        tri.lineTo(posX, posY - shapeHalf);

        tri.moveTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX + shapeHalf - shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX,
                posY - shapeHalf + shapeStrokeSize);
        tri.lineTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
    }

    tri.close();

    c.drawPath(tri, renderPaint);
    tri.reset();

    if (shapeSize > 0.0 &&
            shapeHoleColor != ColorTemplate.COLOR_NONE) {

        renderPaint.setColor(shapeHoleColor);

        tri.moveTo(posX,
                posY - shapeHalf + shapeStrokeSize);
        tri.lineTo(posX + shapeHalf - shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.lineTo(posX - shapeHalf + shapeStrokeSize,
                posY + shapeHalf - shapeStrokeSize);
        tri.close();

        c.drawPath(tri, renderPaint);
        tri.reset();
    }

}
 
Example 19
Source File: SquareShapeRenderer.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    if (shapeSize > 0.0) {
        renderPaint.setStyle(Paint.Style.STROKE);
        renderPaint.setStrokeWidth(shapeStrokeSize);

        c.drawRect(posX - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posY - shapeHoleSizeHalf - shapeStrokeSizeHalf,
                posX + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                posY + shapeHoleSizeHalf + shapeStrokeSizeHalf,
                renderPaint);

        if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
            renderPaint.setStyle(Paint.Style.FILL);

            renderPaint.setColor(shapeHoleColor);
            c.drawRect(posX - shapeHoleSizeHalf,
                    posY - shapeHoleSizeHalf,
                    posX + shapeHoleSizeHalf,
                    posY + shapeHoleSizeHalf,
                    renderPaint);
        }

    } else {
        renderPaint.setStyle(Paint.Style.FILL);

        c.drawRect(posX - shapeHalf,
                posY - shapeHalf,
                posX + shapeHalf,
                posY + shapeHalf,
                renderPaint);
    }
}
 
Example 20
Source File: CircleShapeRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeSize = dataSet.getScatterShapeSize();
    final float shapeHalf = shapeSize / 2f;
    final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
    final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
    final float shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.f;
    final float shapeStrokeSizeHalf = shapeStrokeSize / 2.f;

    final int shapeHoleColor = dataSet.getScatterShapeHoleColor();

    if (shapeSize > 0.0) {
        renderPaint.setStyle(Paint.Style.STROKE);
        renderPaint.setStrokeWidth(shapeStrokeSize);

        c.drawCircle(
                posX,
                posY,
                shapeHoleSizeHalf + shapeStrokeSizeHalf,
                renderPaint);

        if (shapeHoleColor != ColorTemplate.COLOR_NONE) {
            renderPaint.setStyle(Paint.Style.FILL);

            renderPaint.setColor(shapeHoleColor);
            c.drawCircle(
                    posX,
                    posY,
                    shapeHoleSizeHalf,
                    renderPaint);
        }
    } else {
        renderPaint.setStyle(Paint.Style.FILL);

        c.drawCircle(
                posX,
                posY,
                shapeHalf,
                renderPaint);
    }

}