createPolylines method

void createPolylines ()

Creates a polyline for each element of arrays

Implementation

void createPolylines() {
  polylines = List<Polyline>(arrays.length);
  if (poly_colors == null) {
    poly_colors = POLY_COLORS;
  }
  final double YPOS0 = 0.8;

  for (int i = 0; i < arrays.length; i++) {
    if (i == 0 && (plotAttr == null || plotAttr.length != arrays.length)) {
      plotAttr = List<Map<PyA, String>>(arrays.length);
    }

    if (plotAttr[i] == null) {
      plotAttr[i] = Map.from(POLYLINE_DEFAULT_ATTRIBUTES);
      plotAttr[i][PyA.YPOSITION_ZERO] = "$YPOS0";
      plotAttr[i][PyA.STROKE] = poly_colors[i];
    } else {
      if (plotAttr[i][PyA.YPOSITION_ZERO] == null) {
        plotAttr[i][PyA.YPOSITION_ZERO] = "$YPOS0";
      }
      if (plotAttr[i][PyA.STROKE] == null) {
        plotAttr[i][PyA.STROKE] = poly_colors[i];
      }
      Map<PyA, String> attr = Map.from(POLYLINE_DEFAULT_ATTRIBUTES);
      attr.addAll(plotAttr[i]); // merge with defaults
      plotAttr[i] = attr;
    }

    if (i > 0) {
      plotAttr[i][PyA.REFYMAX] = "${polylines[0].ymax}";
    }

    polylines[i] = Polyline(
        arrays[i],
        0,
        arrays[i].length - 1,
        pl.dataAreaRects[plotnum].width,
        pl.dataAreaRects[plotnum].height,
        null,
        null,
        null,
        plotAttr[i]);
  }
}