drawWeb method

void drawWeb(
  1. Canvas c
)

Implementation

void drawWeb(Canvas c) {
  double sliceAngle = _painter!.getSliceAngle();

  // calculate the factor that is needed for transforming the value to
  // pixels
  double factor = _painter!.getFactor();
  double rotationAngle = _painter!.getRotationAngle();

  MPPointF center = _painter!.getCenterOffsets();

  // draw the web lines that come from the center
  var color = _painter!.webColor!;
  _webPaint
    ?..strokeWidth = _painter!.webLineWidth
    ..color = Color.fromARGB(
        _painter!.webAlpha, color.red, color.green, color.blue);

  final int xIncrements = 1 + _painter!.skipWebLineCount;
  int maxEntryCount =
      _painter!.getData()!.getMaxEntryCountSet()!.getEntryCount();

  MPPointF p = MPPointF.getInstance1(0, 0);
  for (int i = 0; i < maxEntryCount; i += xIncrements) {
    Utils.getPosition(center, _painter!.yAxis!.axisRange * factor,
        sliceAngle * i + rotationAngle, p);

    c.drawLine(Offset(center.x, center.y), Offset(p.x, p.y), _webPaint!);
  }
  MPPointF.recycleInstance(p);

  // draw the inner-web
  color = _painter!.webColorInner!;
  _webPaint
    ?..strokeWidth = _painter!.innerWebLineWidth
    ..color = Color.fromARGB(
        _painter!.webAlpha, color.red, color.green, color.blue);

  int labelCount = _painter!.yAxis!.entryCount;

  MPPointF p1out = MPPointF.getInstance1(0, 0);
  MPPointF p2out = MPPointF.getInstance1(0, 0);
  for (int j = 0; j < labelCount; j++) {
    for (int i = 0; i < _painter!.getData()!.getEntryCount(); i++) {
      double r =
          (_painter!.yAxis!.entries[j] - _painter!.getYChartMin()!) * factor;

      Utils.getPosition(center, r, sliceAngle * i + rotationAngle, p1out);
      Utils.getPosition(
          center, r, sliceAngle * (i + 1) + rotationAngle, p2out);

      c.drawLine(
          Offset(p1out.x, p1out.y), Offset(p2out.x, p2out.y), _webPaint!);
    }
  }
  MPPointF.recycleInstance(p1out);
  MPPointF.recycleInstance(p2out);
}