drawDataSet method
Implementation
void drawDataSet(Canvas c, IBubbleDataSet dataSet) {
if (dataSet.getEntryCount() < 1) return;
Transformer trans = _provider!.getTransformer(dataSet.getAxisDependency())!;
double phaseY = animator!.getPhaseY();
xBounds!.set(_provider!, dataSet);
sizeBuffer[0] = 0;
sizeBuffer[2] = 1;
trans.pointValuesToPixel(sizeBuffer);
bool normalizeSize = dataSet.isNormalizeSizeEnabled();
// calcualte the full width of 1 step on the x-axis
final double maxBubbleWidth = (sizeBuffer[2]! - sizeBuffer[0]!).abs();
final double maxBubbleHeight =
(viewPortHandler!.contentBottom() - viewPortHandler!.contentTop())
.abs();
final double referenceSize = min(maxBubbleHeight, maxBubbleWidth);
for (int j = xBounds!.min!; j <= xBounds!.range! + xBounds!.min!; j++) {
final BubbleEntry entry = dataSet.getEntryForIndex(j)!;
pointBuffer[0] = entry.x;
pointBuffer[1] = entry.y * phaseY;
trans.pointValuesToPixel(pointBuffer);
double shapeHalf = getShapeSize(
entry.size, dataSet.getMaxSize(), referenceSize, normalizeSize) /
2;
if (!viewPortHandler!.isInBoundsTop(pointBuffer[1]! + shapeHalf) ||
!viewPortHandler!.isInBoundsBottom(pointBuffer[1]! - shapeHalf)) {
continue;
}
if (!viewPortHandler!.isInBoundsLeft(pointBuffer[0]! + shapeHalf)) {
continue;
}
if (!viewPortHandler!.isInBoundsRight(pointBuffer[0]! - shapeHalf)) break;
final Color color = dataSet.getColor2(entry.x.toInt());
renderPaint!.color = color;
c.drawCircle(
Offset(pointBuffer[0]!, pointBuffer[1]!), shapeHalf, renderPaint!);
}
}