drawAxis method
Implementation
void drawAxis(Canvas canvas, Size graph, Size margin) {
Paint linePaint = Paint()
..color = graphColor
..strokeWidth = 1;
Offset xEnd =
Offset(graph.width + 2 * margin.width, graph.height + margin.height);
Offset yStart = Offset(margin.width, 0);
//X-Axis & Y-Axis
canvas.drawLine(
Offset(margin.width, graph.height + margin.height), xEnd, linePaint);
canvas.drawLine(
yStart, Offset(margin.width, graph.height + margin.height), linePaint);
//Arrow heads
canvas.drawLine(xEnd, Offset(xEnd.dx - 5, xEnd.dy - 5), linePaint);
canvas.drawLine(xEnd, Offset(xEnd.dx - 5, xEnd.dy + 5), linePaint);
canvas.drawLine(yStart, Offset(yStart.dx - 5, yStart.dy + 5), linePaint);
canvas.drawLine(yStart, Offset(yStart.dx + 5, yStart.dy + 5), linePaint);
}