getBoundsForBar method
Rectangle<int>
getBoundsForBar(
- BarTargetLineRendererElement bar
)
Implementation
@override
Rectangle<int> getBoundsForBar(BarTargetLineRendererElement bar) {
final points = bar.points;
assert(points.isNotEmpty, 'Bar must have at least one point.');
var top = points.first.y;
var bottom = points.first.y;
var left = points.first.x;
var right = points.first.x;
for (final point in points.skip(1)) {
top = min(top, point.y);
left = min(left, point.x);
bottom = max(bottom, point.y);
right = max(right, point.x);
}
return Rectangle<int>(left, top, right - left, bottom - top);
}