use of com.github.mikephil.charting.renderer.scatter.IShapeRenderer in project MPAndroidChart by PhilJay.
the class ScatterChartRenderer method drawDataSet.
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);
}
}
Aggregations