I created a test application that works like I want it to. However now that I am trying to implement it the same way into an existing application, the opacity value I am setting is being ignored. This complexity of this custom control (using a RadCartesianChart) is pretty crazy. I just can't find out what is causing it to ignore what I am setting.
Attached is what the chart looks like without and with mouse-overing a LineSeries. The idea is to highlight the LineSeries the trackball is describing.
Below is how I am setting the opacity in a custom behavior. I have even tried
- setting the opacity of each series on the RadCartesianChart itself
- setting the opacity on the style being used for the LineSeries
- setting up a style trigger to set the opacity value when the IsSelected property is modified in the behavior
Does anyone have an ideas?
01.private static void ChartTrackBallBehavior_TrackInfoUpdated(object sender, TrackBallInfoEventArgs e)02.{03. ChartDataContext context = e.Context;04. 05. DataPointInfo closestDataPointInfo = context.DataPointInfos06. .OrderBy(x => Math.Abs(e.Context.TouchLocation.Y - x.DataPoint.LayoutSlot.Y)).FirstOrDefault();07. 08. foreach (DataPointInfo dataPointInfo in context.DataPointInfos)09. {10. if (dataPointInfo == closestDataPointInfo)11. {12. if (dataPointInfo?.DataPoint.DataItem is ChartItem chartItem)13. {14. ChildChartViewModel childChartViewModel = dataPointInfo.Series.Chart.DataContext as ChildChartViewModel;15. 16. string time = chartItem.XValue.ToString(childChartViewModel?.LabelFormat ?? string.Empty);17. string value = chartItem.YValue.ToString(childChartViewModel?.VerticalAxis.DataFormatString ?? string.Empty);18. 19. dataPointInfo.DisplayContent = $"({time}, {value})";20. dataPointInfo.Series.Opacity = 1;21. dataPointInfo.Series.Tag = "Add";22. }23. }24. else25. {26. dataPointInfo.Series.Opacity = 0.33;27. dataPointInfo.Series.Tag = "Remove";28. }29. }30. 31. e.Context.DataPointInfos.RemoveAll(x => x.Series.Tag.ToString() == "Remove");32.}