generateAboveBarPath method
Path
generateAboveBarPath(
- Size viewSize,
- LineChartBarData barData,
- Path barPath,
- List<
AFlSpot> barSpots, - PaintHolder<
LineChartData> holder, { - bool fillCompletely = false,
it generates above area path using a copy of barPath
,
if cutOffY is provided by the BarAreaData, it cut the area to the provided cutOffY value,
if fillCompletely
is true, the cutOffY will be ignored,
and a completely filled path will return,
Implementation
@visibleForTesting
Path generateAboveBarPath(
Size viewSize,
LineChartBarData barData,
Path barPath,
List<AFlSpot> barSpots,
PaintHolder<LineChartData> holder, {
bool fillCompletely = false,
}) {
final aboveBarPath = Path.from(barPath);
/// Line To Top Right
var x = getPixelX(barSpots[barSpots.length - 1].x, viewSize, holder);
double y;
if (!fillCompletely && barData.aboveBarData.applyCutOffY) {
y = getPixelY(barData.aboveBarData.cutOffY, viewSize, holder);
} else {
y = 0.0;
}
aboveBarPath.lineTo(x, y);
/// Line To Top Left
x = getPixelX(barSpots[0].x, viewSize, holder);
if (!fillCompletely && barData.aboveBarData.applyCutOffY) {
y = getPixelY(barData.aboveBarData.cutOffY, viewSize, holder);
} else {
y = 0.0;
}
aboveBarPath.lineTo(x, y);
/// Line To Bottom Left
x = getPixelX(barSpots[0].x, viewSize, holder);
y = getPixelY(barSpots[0].y, viewSize, holder);
aboveBarPath
..lineTo(x, y)
..close();
return aboveBarPath;
}