/// <summary> /// An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex. /// </summary> protected virtual IList <Highlight> BuildHighlights(IDataSet set, int dataSetIndex, float xVal, DataSetRounding rounding) { IList <Highlight> highlights = new List <Highlight>(); //noinspection unchecked IList <Entry> entries = set.EntriesForXValue(xVal); if (entries.Count == 0) { // Try to find closest x-value and take all entries for that x-value Entry closest = set.EntryForXValue(xVal, float.NaN, rounding); if (closest != null) { //noinspection unchecked entries = set.EntriesForXValue(closest.X); } } if (entries.Count == 0) { return(highlights); } foreach (Entry e in entries) { var pixels = Chart.GetTransformer( set.AxisDependency).PointValueToPixel(e.X, e.Y); highlights.Add(new Highlight( e.X, e.Y, (float)pixels.X, (float)pixels.Y, dataSetIndex, set.AxisDependency)); } return(highlights); }