WPF Toolkit un-obscuring overlapping datapoints

Aug 4, 2010 at 8:49 PM
Edited Aug 4, 2010 at 9:05 PM

I would like to render two line series datapoints (each from a different line series) which happen to have the same coordinates in a side-by-side manner so as not to obscure one or the other.

I am looking for a clean way to accomplish the above.

I looked into the source code for the LineAreaBaseSeries class and thought that overriding and specializing the UpdateDataPoint method might be the place to accomplish this but I am having second thoughts. I was attracted to this method because I see that the coordinates of the data point are adjusted there. However this affords only part of the solution as the additional information for the neighboring datapoints seems to be unavailable. Logically, I have my business level data point classes already primed with the necessary information indicating their potential need to shift the rendering of the data point on the graph to the left or right.

Also, I am suspicious that adjusting the dataPoint’s Top and Left coordinates might cause the connecting polyline to not actually draw to the true coordinates of the data point; but that is another problem I suppose.

What I would like to do is to simply shift the rendered data point image to the left or right a full 'dataPoint.ActualWidth' as maybe required to make sure overlapping images do not actually overlap each other. I want them to sort of render nearby the data point.

Has anyone an idea or link to a reference as to how to accomplish this?

Thanks in advance.

Kyle

 

For convenience, here is part of the LineSeries source code I am attempting totalk about:

        protected override void UpdateDataPoint(DataPoint dataPoint)
        {
            double maximum = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value;
            if (ValueHelper.CanGraph(maximum))
            {
                double x = ActualIndependentAxis.GetPlotAreaCoordinate(dataPoint.ActualIndependentValue).Value;
                double y = ActualDependentRangeAxis.GetPlotAreaCoordinate(dataPoint.ActualDependentValue).Value;

                if (ValueHelper.CanGraph(x) && ValueHelper.CanGraph(y))
                {
                    dataPoint.Visibility = Visibility.Visible;

                    double coordinateY = Math.Round(maximum - (y + (dataPoint.ActualHeight / 2)));
                    Canvas.SetTop(dataPoint, coordinateY);
                    double coordinateX = Math.Round(x - (dataPoint.ActualWidth / 2));
                    Canvas.SetLeft(dataPoint, coordinateX);
                }
                else
                {
                    dataPoint.Visibility = Visibility.Collapsed;
                }
            }

            if (!UpdatingDataPoints)
            {
                UpdateShape();
            }
        }