Example #1
0
        protected override Rect GetBoundingRectangleCore()
        {
            if (this.Series == null || this.Series.ChartArea == null || !this.Series.ChartArea.IsTemplateApplied)
            {
                return(base.GetBoundingRectangleCore());
            }
            FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(this.DataPoint);

            if (dataPointView != null)
            {
                return(new FrameworkElementAutomationPeer(dataPointView).GetBoundingRectangle());
            }
            AutomationPeer peerForElement = UIElementAutomationPeer.CreatePeerForElement((UIElement)this.Series);

            if (!(this.Series is LineSeries) || this.DataPoint.View == null || peerForElement == null)
            {
                return(base.GetBoundingRectangleCore());
            }
            Point anchorPoint       = this.DataPoint.View.AnchorPoint;
            Rect  rectangle         = RectExtensions.Expand(new Rect(anchorPoint.X, anchorPoint.Y, 0.0, 0.0), 2.0, 2.0);
            Rect  boundingRectangle = peerForElement.GetBoundingRectangle();
            Size  renderSize        = this.Series.SeriesPresenter.RootPanel.RenderSize;
            Size  size = RectExtensions.GetSize(boundingRectangle);

            return(RectExtensions.Translate(RectExtensions.Transform(rectangle, (Transform) new ScaleTransform()
            {
                ScaleX = (size.Width / renderSize.Width),
                ScaleY = (size.Height / renderSize.Height)
            }), boundingRectangle.X, boundingRectangle.Y));
        }
Example #2
0
        internal override Geometry GetSelectionOutline(DataPoint dataPoint)
        {
            if (dataPoint.View == null)
            {
                return((Geometry)null);
            }
            Rect  rect1       = new Rect(0.0, 0.0, 6.0, 6.0);
            Point anchorPoint = dataPoint.View.AnchorPoint;

            if (double.IsNaN(anchorPoint.X) || double.IsInfinity(anchorPoint.X) || (double.IsNaN(anchorPoint.Y) || double.IsInfinity(anchorPoint.Y)))
            {
                return((Geometry)null);
            }
            Rect             rect2 = new Rect(anchorPoint.X - rect1.Width / 2.0, anchorPoint.Y - rect1.Height / 2.0, rect1.Width, rect1.Height);
            FrameworkElement child = Enumerable.FirstOrDefault <FrameworkElement>(Enumerable.OfType <FrameworkElement>((IEnumerable)this.RootPanel.Children));

            return((Geometry) new RectangleGeometry()
            {
                Rect = RectExtensions.Expand(RectExtensions.TranslateToParent(rect2, child, (FrameworkElement)this.ChartArea), 1.0, 1.0)
            });
        }