drawHighlighted method
Draws all highlight indicators for the values that are currently highlighted.
@param c @param indices the highlighted values
Implementation
@override
void drawHighlighted(Canvas c, List<Highlight>? indices) {
double sliceAngle = _painter!.getSliceAngle();
// calculate the factor that is needed for transforming the value to
// pixels
double factor = _painter!.getFactor();
MPPointF center = _painter!.getCenterOffsets();
MPPointF pOut = MPPointF.getInstance1(0, 0);
RadarData? radarData = _painter!.getData() as RadarData?;
for (Highlight high in indices!) {
IRadarDataSet? set = radarData!.getDataSetByIndex(high.dataSetIndex ?? 0);
if (set == null || !set.isHighlightEnabled()) continue;
RadarEntry? e = set.getEntryForIndex(high.x!.toInt());
if (!isInBoundsX(e, set)) continue;
double y = (e!.y - _painter!.getYChartMin()!);
Utils.getPosition(
center,
y * factor * animator!.getPhaseY(),
sliceAngle * high.x! * animator!.getPhaseX() +
_painter!.getRotationAngle(),
pOut);
high.setDraw(pOut.x, pOut.y);
// draw the lines
drawHighlightLines(c, pOut.x, pOut.y, set);
if (set.isDrawHighlightCircleEnabled()) {
if (!pOut.x.isNaN && !pOut.y.isNaN) {
Color strokeColor = set.getHighlightCircleStrokeColor();
if (strokeColor == ColorUtils.colorNone) {
strokeColor = set.getColor2(0);
}
if (set.getHighlightCircleStrokeAlpha() < 255) {
strokeColor = ColorUtils.colorWithAlpha(
strokeColor, set.getHighlightCircleStrokeAlpha());
}
drawHighlightCircle(
c,
pOut,
set.getHighlightCircleInnerRadius(),
set.getHighlightCircleOuterRadius(),
set.getHighlightCircleFillColor(),
strokeColor,
set.getHighlightCircleStrokeWidth());
}
}
}
MPPointF.recycleInstance(center);
MPPointF.recycleInstance(pOut);
}