drawPolylineMarkers method
Draws vertical lines above the polyline dpy.
markerIndices
- the x positions of the lines (indices in the dpy's array.
markerLabels
- text labels drawn together with lines. If not null, the
length of this array must be the same as that of markerIndices
.
markerAttrList
- marker attributes. If null, MARKER_DEFAULT_ATTRIBUTES
are used. Otherwise, the length of this array must be the same as that of
markerIndices
.
Implementation
void drawPolylineMarkers(List<double> markerIndices,
List<String> markerLabels, List<Map<MarA, String>> markerAttrList) {
SvgSvgElement ticksContainer, labelsContainer;
if (ticksContainer != null) {
ticksContainer.remove(); // remove existing ticks
ticksContainer = null;
labelsContainer.remove(); // remove existing ticks
labelsContainer = null;
}
ticksContainer = SvgSvgElement();
labelsContainer = SvgSvgElement();
int lastLabpos = 0; // remember last drawn label position
Map<MarA, String> markerAttr;
int nticks = markerIndices.length;
if (markerLabels != null && markerLabels.length != nticks) {
throw ("markerIndices and markerLabels must have same length!");
}
for (int i = 0; i < nticks; i++) {
double yphys = dpy.array[markerIndices[i].round()];
if (markerAttrList != null && markerAttrList.length == nticks) {
markerAttr = markerAttrList[i];
}
drawMarker(ticksContainer, labelsContainer, markerIndices[i],
markerLabels[i], yphys, lastLabpos, markerAttr);
}
dpy.polylineContainer..append(ticksContainer)..append(labelsContainer);
}