LineChartPainter class

Paints LineChartData in the canvas, it can be used in a CustomPainter

Inheritance

Constructors

LineChartPainter()
Paints dataList into canvas, it is the animating LineChartData, targetData is the animation's target and remains the same during animation, then we should use it when we need to show tooltips or something like that, because dataList is changing constantly.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clipToBorder(CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
drawAboveBar(CanvasWrapper canvasWrapper, Path aboveBarPath, Path filledBelowBarPath, PaintHolder<LineChartData> holder, LineChartBarData barData) → void
firstly we draw aboveBarPath, then if cutOffY value is provided in BarAreaData, aboveBarPath maybe draw over the main bar line, then to fix the problem we use filledBelowBarPath to clear the above section from this draw.
drawBackground(CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
This function draws a colored background behind the chart.
inherited
drawBar(CanvasWrapper canvasWrapper, Path barPath, LineChartBarData barData, PaintHolder<LineChartData> holder) → void
draw the main bar line by the barPath
drawBarLine(CanvasWrapper canvasWrapper, LineChartBarData barData, PaintHolder<LineChartData> holder) → void
drawBarShadow(CanvasWrapper canvasWrapper, Path barPath, LineChartBarData barData) → void
draw the main bar line's shadow by the barPath
drawBelowBar(CanvasWrapper canvasWrapper, Path belowBarPath, Path filledAboveBarPath, PaintHolder<LineChartData> holder, LineChartBarData barData) → void
firstly we draw belowBarPath, then if cutOffY value is provided in BarAreaData, belowBarPath maybe draw over the main bar line, then to fix the problem we use filledAboveBarPath to clear the above section from this draw.
drawBetweenBar(CanvasWrapper canvasWrapper, Path barPath, BetweenBarsData betweenBarsData, Rect aroundRect, PaintHolder<LineChartData> holder) → void
drawBetweenBarsArea(CanvasWrapper canvasWrapper, LineChartData data, BetweenBarsData betweenBarsData, PaintHolder<LineChartData> holder) → void
drawDots(CanvasWrapper canvasWrapper, LineChartBarData barData, PaintHolder<LineChartData> holder) → void
drawExtraLines(BuildContext context, CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
inherited
drawGrid(CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
inherited
drawHorizontalLines(BuildContext context, CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder, Size viewSize) → void
inherited
drawRangeAnnotation(CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
inherited
drawTouchedSpotsIndicator(CanvasWrapper canvasWrapper, List<LineIndexDrawingInfo> lineIndexDrawingInfo, PaintHolder<LineChartData> holder) → void
drawTouchTooltip(BuildContext context, CanvasWrapper canvasWrapper, LineTouchTooltipData tooltipData, AFlSpot showOnSpot, ShowingTooltipIndicators showingTooltipSpots, PaintHolder<LineChartData> holder) → void
drawVerticalLines(BuildContext context, CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder, Size viewSize) → void
inherited
generateAboveBarPath(Size viewSize, LineChartBarData barData, Path barPath, List<AFlSpot> barSpots, PaintHolder<LineChartData> holder, {bool fillCompletely = false}) Path
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,
generateBarPath(Size viewSize, LineChartBarData barData, List<AFlSpot> barSpots, PaintHolder<LineChartData> holder, {Path? appendToPath}) Path
Generates a path, based on LineChartBarData.isStepChart for step style, and normal style.
generateBelowBarPath(Size viewSize, LineChartBarData barData, Path barPath, List<AFlSpot> barSpots, PaintHolder<LineChartData> holder, {bool fillCompletely = false}) Path
it generates below 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,
generateNormalBarPath(Size viewSize, LineChartBarData barData, List<AFlSpot> barSpots, PaintHolder<LineChartData> holder, {Path? appendToPath}) Path
firstly we generate the bar line that we should draw, then we reuse it to fill below bar space. there is two type of barPath that generate here, first one is the sharp corners line on spot connections second one is curved corners line on spot connections, and we use isCurved to find out how we should generate it, If you want to concatenate paths together for creating an area between multiple bars for example, you can pass the appendToPath
generateStepBarPath(Size viewSize, LineChartBarData barData, List<AFlSpot> barSpots, PaintHolder<LineChartData> holder, {Path? appendToPath}) Path
generates a Step Line Chart bar style path.
getBarLineXLength(LineChartBarData barData, Size chartUsableSize, PaintHolder<LineChartData> holder) double
getNearestTouchedSpot(Size viewSize, Offset touchedPoint, LineChartBarData barData, int barDataPosition, PaintHolder<LineChartData> holder) TouchLineBarSpot?
find the nearest spot base on the touched offset
getPixelX(double spotX, Size viewSize, PaintHolder<LineChartData> holder) double
With this function we can convert our AFlSpot x to the view base axis x . the view 0, 0 is on the top/left, but the spots is bottom/left
inherited
getPixelY(double spotY, Size viewSize, PaintHolder<LineChartData> holder) double
With this function we can convert our AFlSpot y to the view base axis y.
inherited
getTooltipLeft(double dx, double tooltipWidth, FLHorizontalAlignment tooltipHorizontalAlignment, double tooltipHorizontalOffset) double
With this function we can get horizontal position for the tooltip.
inherited
handleTouch(Offset localPosition, Size size, PaintHolder<LineChartData> holder) List<TouchLineBarSpot>?
Makes a LineTouchResponse based on the provided localPosition
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(BuildContext context, CanvasWrapper canvasWrapper, PaintHolder<LineChartData> holder) → void
Paints LineChartData into the provided canvas.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited