Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IScatterDataSet#getScatterShapeHoleColor()
The following examples show how to use
com.github.mikephil.charting.interfaces.datasets.IScatterDataSet#getScatterShapeHoleColor() .
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: CircleShapeRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@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 2
Source File: TriangleShapeRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@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 3
Source File: SquareShapeRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@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 4
Source File: CircleShapeRenderer.java From Ticket-Analysis with MIT License | 4 votes |
@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 5
Source File: TriangleShapeRenderer.java From Ticket-Analysis with MIT License | 4 votes |
@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 6
Source File: SquareShapeRenderer.java From Ticket-Analysis with MIT License | 4 votes |
@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 7
Source File: CircleShapeRenderer.java From android-kline with Apache License 2.0 | 4 votes |
@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 8
Source File: TriangleShapeRenderer.java From android-kline with Apache License 2.0 | 4 votes |
@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 9
Source File: SquareShapeRenderer.java From android-kline with Apache License 2.0 | 4 votes |
@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 10
Source File: CircleShapeRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void renderShape( Canvas c, IScatterDataSet dataSet, ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) { 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(); for (int i = 0; i < buffer.size(); i += 2) { if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break; if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue; mRenderPaint.setColor(dataSet.getColor(i / 2)); if (shapeSize > 0.0) { mRenderPaint.setStyle(Paint.Style.STROKE); mRenderPaint.setStrokeWidth(shapeStrokeSize); c.drawCircle( buffer.buffer[i], buffer.buffer[i + 1], shapeHoleSizeHalf + shapeStrokeSizeHalf, mRenderPaint); if (shapeHoleColor != ColorTemplate.COLOR_NONE) { mRenderPaint.setStyle(Paint.Style.FILL); mRenderPaint.setColor(shapeHoleColor); c.drawCircle( buffer.buffer[i], buffer.buffer[i + 1], shapeHoleSizeHalf, mRenderPaint); } } else { mRenderPaint.setStyle(Paint.Style.FILL); c.drawCircle( buffer.buffer[i], buffer.buffer[i + 1], shapeHalf, mRenderPaint); } } }
Example 11
Source File: TriangleShapeRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void renderShape( Canvas c, IScatterDataSet dataSet, ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) { 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(); mRenderPaint.setStyle(Paint.Style.FILL); // create a triangle path Path tri = new Path(); for (int i = 0; i < buffer.size(); i += 2) { if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break; if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue; mRenderPaint.setColor(dataSet.getColor(i / 2)); tri.moveTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf); tri.lineTo(buffer.buffer[i] + shapeHalf, buffer.buffer[i + 1] + shapeHalf); tri.lineTo(buffer.buffer[i] - shapeHalf, buffer.buffer[i + 1] + shapeHalf); if (shapeSize > 0.0) { tri.lineTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf); tri.moveTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize, buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize); tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize, buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize); tri.lineTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize); tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize, buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize); } tri.close(); c.drawPath(tri, mRenderPaint); tri.reset(); if (shapeSize > 0.0 && shapeHoleColor != ColorTemplate.COLOR_NONE) { mRenderPaint.setColor(shapeHoleColor); tri.moveTo(buffer.buffer[i], buffer.buffer[i + 1] - shapeHalf + shapeStrokeSize); tri.lineTo(buffer.buffer[i] + shapeHalf - shapeStrokeSize, buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize); tri.lineTo(buffer.buffer[i] - shapeHalf + shapeStrokeSize, buffer.buffer[i + 1] + shapeHalf - shapeStrokeSize); tri.close(); c.drawPath(tri, mRenderPaint); tri.reset(); } } }
Example 12
Source File: SquareShapeRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void renderShape( Canvas c, IScatterDataSet dataSet, ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) { 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(); for (int i = 0; i < buffer.size(); i += 2) { if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break; if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue; mRenderPaint.setColor(dataSet.getColor(i / 2)); if (shapeSize > 0.0) { mRenderPaint.setStyle(Paint.Style.STROKE); mRenderPaint.setStrokeWidth(shapeStrokeSize); c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf - shapeStrokeSizeHalf, buffer.buffer[i + 1] - shapeHoleSizeHalf - shapeStrokeSizeHalf, buffer.buffer[i] + shapeHoleSizeHalf + shapeStrokeSizeHalf, buffer.buffer[i + 1] + shapeHoleSizeHalf + shapeStrokeSizeHalf, mRenderPaint); if (shapeHoleColor != ColorTemplate.COLOR_NONE) { mRenderPaint.setStyle(Paint.Style.FILL); mRenderPaint.setColor(shapeHoleColor); c.drawRect(buffer.buffer[i] - shapeHoleSizeHalf, buffer.buffer[i + 1] - shapeHoleSizeHalf, buffer.buffer[i] + shapeHoleSizeHalf, buffer.buffer[i + 1] + shapeHoleSizeHalf, mRenderPaint); } } else { mRenderPaint.setStyle(Paint.Style.FILL); c.drawRect(buffer.buffer[i] - shapeHalf, buffer.buffer[i + 1] - shapeHalf, buffer.buffer[i] + shapeHalf, buffer.buffer[i + 1] + shapeHalf, mRenderPaint); } } }