buildHighlights method
An array of Highlight
objects corresponding to the selected xValue and dataSetIndex.
@param set @param dataSetIndex @param xVal @param rounding @return
Implementation
@override
List<Highlight> buildHighlights(
IDataSet set, int dataSetIndex, double xVal, Rounding rounding) {
List<Highlight> highlights = List.empty(growable: true);
//noinspection unchecked
List<Entry?> entries = set.getEntriesForXValue(xVal);
if (entries.isEmpty) {
// Try to find closest x-value and take all entries for that x-value
final Entry? closest = set.getEntryForXValue1(xVal, double.nan, rounding);
if (closest != null) {
//noinspection unchecked
entries = set.getEntriesForXValue(closest.x);
}
}
if (entries.isEmpty) return highlights;
for (Entry? e in entries) {
MPPointD pixels = provider!
.getTransformer(set.getAxisDependency())!
.getPixelForValues(e!.y, e.x);
highlights.add(Highlight(
x: e.x,
y: e.y,
xPx: pixels.x,
yPx: pixels.y,
dataSetIndex: dataSetIndex,
axis: set.getAxisDependency()));
}
return highlights;
}