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) {
  canvas.drawLine(Offset(0, chartRect.top),
      Offset(chartRect.width, chartRect.top), gridPaint);
  canvas.drawLine(Offset(0, chartRect.bottom),
      Offset(chartRect.width, chartRect.bottom), gridPaint);
  double columnSpace = chartRect.width / gridColumns;
  for (int i = 0; i <= columnSpace; i++) {
    //mSecondaryRect垂直线
    canvas.drawLine(Offset(columnSpace * i, chartRect.top - topPadding),
        Offset(columnSpace * i, chartRect.bottom), gridPaint);
  }
}