Completed
Last Updated: 29 May 2023 08:54 by ADMIN
Release R2 2023
Martin Ivanov
Created on: 15 May 2023 13:07
Category: ChartView
Type: Bug Report
0
ChartView: Trackball visuals go outside the plot area on zoom-in or pan

The trackball visuals are the ellipses that snap to the data points when you enable the trackball behavior and hover the plot area. If a trackball is displayed and you zoom-in (via mouse wheel) or pan (via drag), the trackball visuals stay on the proper data point as expected. However, if the zoom-in forces the corresponding data point to go outside the viewport, the trackball follows it and it doesn't get hidden (because it is outside the viewport/plot area).

To work this around, you can manually hide the Ellipse visuals.

private void RadChart_PanOffsetChanged(object sender, Telerik.Windows.Controls.ChartView.ChartPanOffsetChangedEventArgs e)
{
	Dispatcher.BeginInvoke(new Action(() =>
	{
		var chart = (RadCartesianChart)sender;
		var trackballs = chart.ChildrenOfType<Ellipse>().Where(x => x.DataContext is DataPointInfo);
		foreach (Ellipse visual in trackballs)
		{
			var dpInfo = (DataPointInfo)visual.DataContext;
			RadRect dpSlot = dpInfo.DataPoint.LayoutSlot;
			if (!chart.PlotAreaClip.Contains(dpSlot.X, dpSlot.Y))
			{
				visual.Opacity = 0;
			}
			else
			{
				if (visual.Opacity == 0)
				{
					visual.Opacity = 1;
				}
			}
		}
	}));
}

0 comments