drawGrid method

  1. @override
void drawGrid(
  1. Canvas canvas,
  2. int gridRows,
  3. int gridColumns
)
override

Implementation

@override
void drawGrid(Canvas canvas, int gridRows, int gridColumns) {
//    final int gridRows = 4, gridColumns = 4;
  double rowSpace = chartRect.height / gridRows;
  for (int i = 0; i <= gridRows; i++) {
    canvas.drawLine(Offset(0, rowSpace * i + topPadding),
        Offset(chartRect.width, rowSpace * i + topPadding), gridPaint);
  }
  double columnSpace = chartRect.width / gridColumns;
  for (int i = 0; i <= columnSpace; i++) {
    canvas.drawLine(Offset(columnSpace * i, topPadding / 3),
        Offset(columnSpace * i, chartRect.bottom), gridPaint);
  }
}