buildActiveGrid method
Draws the grid into a temporary container, and when done, replaces gridContainer (possibly already containing a grid) by the new temporary container containing the new grid.
Implementation
void buildActiveGrid() {
LineElement linex, liney;
SvgSvgElement anXYGrid = SvgSvgElement();
if (xValues != null) {
for (int i = 0; i < xValues.length; i++) {
if (xValues != null && xValues.isNotEmpty) {
liney = LineElement(); // line parallel to y axis
SVG.setAttr(liney, {
SVG.X1: "${xValues[i]}",
SVG.Y1: "0",
SVG.X2: "${xValues[i]}",
SVG.Y2: "${yLength}",
SVG.STROKE: attributes[AxA.XYGRID_STROKE],
SVG.STROKE_WIDTH: attributes[AxA.XYGRID_STROKE_WIDTH],
SVG.STROKE_OPACITY: attributes[AxA.XYGRID_STROKE_OPACITY],
SVG.STROKE_DASHARRY: attributes[AxA.XYGRID_STROKE_DASH],
});
anXYGrid.append(liney);
}
}
}
if (yValues != null) {
for (int i = 0; i < yValues.length; i++) {
if (yValues != null && yValues.isNotEmpty) {
linex = LineElement(); // line parallel to x axis
SVG.setAttr(linex, {
SVG.X1: "0",
SVG.Y1: "${yValues[i]}",
SVG.X2: "${xLength}",
SVG.Y2: "${yValues[i]}",
SVG.STROKE: attributes[AxA.XYGRID_STROKE],
SVG.STROKE_WIDTH: attributes[AxA.XYGRID_STROKE_WIDTH],
SVG.STROKE_OPACITY: attributes[AxA.XYGRID_STROKE_OPACITY],
SVG.STROKE_DASHARRY: attributes[AxA.XYGRID_STROKE_DASH],
});
anXYGrid.append(linex);
}
}
}
gridContainer = anXYGrid;
}