drawHorizontalAxesMinorLines method

  1. @override
void drawHorizontalAxesMinorLines(
  1. Canvas canvas,
  2. ChartAxisRenderer axisRenderer,
  3. double tempInterval,
  4. Rect rect,
  5. num nextValue,
  6. int index,
  7. SfCartesianChart chart, [
  8. String? renderType,
])

To draw the minor grid lines of horizontal axes

Implementation

@override
void drawHorizontalAxesMinorLines(
    Canvas canvas,
    ChartAxisRenderer axisRenderer,
    double tempInterval,
    Rect rect,
    num nextValue,
    int index,
    SfCartesianChart chart,
    [String? renderType]) {
  double position = tempInterval;
  final ChartAxis axis = axisRenderer._axis;
  final MinorTickLines ticks = axis.minorTickLines;
  final num interval =
      (tempInterval - nextValue).abs() / (axis.minorTicksPerInterval + 1);
  for (int i = 0; i < axis.minorTicksPerInterval; i++) {
    position =
        axis.isInversed ? (position - interval) : (position + interval);
    final double pointY = rect.top;
    if (axis.minorGridLines.width > 0 &&
        renderType == 'outside' &&
        (axisRenderer._bounds.left <= position &&
            axisRenderer._bounds.right >= position)) {
      _drawDashedPath(
          canvas,
          _CustomPaintStyle(
              axisRenderer.getAxisMinorGridWidth(
                  axisRenderer._axis, index, i),
              axisRenderer.getAxisMinorGridColor(
                      axisRenderer._axis, index, i) ??
                  _chartState._chartTheme.minorGridLineColor,
              PaintingStyle.stroke),
          Offset(position, _chartState._chartAxis._axisClipRect.top),
          Offset(
              position,
              _chartState._chartAxis._axisClipRect.top +
                  _chartState._chartAxis._axisClipRect.height),
          axis.minorGridLines.dashArray);
    }

    if (axis.minorTickLines.width > 0 &&
        axisRenderer._bounds.left <= position &&
        axisRenderer._bounds.right >= position &&
        renderType == axis.tickPosition.toString().split('.')[1]) {
      _drawDashedPath(
          canvas,
          _CustomPaintStyle(
              axisRenderer.getAxisMinorTickWidth(axis, index, i),
              axisRenderer.getAxisMinorTickColor(axis, index, i) ??
                  _chartState._chartTheme.minorTickLineColor,
              PaintingStyle.stroke),
          Offset(position, pointY),
          Offset(
              position,
              !axis.opposedPosition
                  ? (axisRenderer._isInsideTickPosition!
                      ? pointY - ticks.size
                      : pointY + ticks.size)
                  : (axisRenderer._isInsideTickPosition!
                      ? pointY + ticks.size
                      : pointY - ticks.size)),
          axis.minorGridLines.dashArray);
    }
  }
}