private static Point GetCalloutPoint(Rect position, ContentPositions contentAlignment, RectOrientation rectOrientation) { Point point = new Point(position.X, position.Y); if (contentAlignment == ContentPositions.MiddleCenter || contentAlignment == ContentPositions.MiddleLeft || contentAlignment == ContentPositions.MiddleRight) point.Y += position.Height / 2.0; else if (contentAlignment == ContentPositions.TopCenter || contentAlignment == ContentPositions.TopLeft || contentAlignment == ContentPositions.TopRight) point.Y = position.Bottom; if (contentAlignment == ContentPositions.TopCenter || contentAlignment == ContentPositions.MiddleCenter || contentAlignment == ContentPositions.BottomCenter) point.X += position.Width / 2.0; else if (contentAlignment == ContentPositions.TopLeft || contentAlignment == ContentPositions.MiddleLeft || contentAlignment == ContentPositions.BottomLeft) point.X = position.Right; if (contentAlignment == ContentPositions.OutsideBase) { if (rectOrientation == RectOrientation.BottomTop) point = new Point(position.X + position.Width / 2.0, position.Y); else if (rectOrientation == RectOrientation.TopBottom) point = new Point(position.X + position.Width / 2.0, position.Bottom); else if (rectOrientation == RectOrientation.LeftRight) point = new Point(position.Right, position.Y + position.Height / 2.0); else if (rectOrientation == RectOrientation.RightLeft) point = new Point(position.X, position.Y + position.Height / 2.0); } else if (contentAlignment == ContentPositions.OutsideEnd) { if (rectOrientation == RectOrientation.BottomTop) point = new Point(position.X + position.Width / 2.0, position.Bottom); else if (rectOrientation == RectOrientation.TopBottom) point = new Point(position.X + position.Width / 2.0, position.Y); else if (rectOrientation == RectOrientation.LeftRight) point = new Point(position.X, position.Y + position.Height / 2.0); else if (rectOrientation == RectOrientation.RightLeft) point = new Point(position.Right, position.Y + position.Height / 2.0); } return point; }
private static Rect CalculateContentPosition(Rect anchorRect, RectOrientation anchorRectOrientation, ContentPositions contentPosition, Size contentSize, double offset) { switch (contentPosition) { case ContentPositions.InsideEnd: switch (anchorRectOrientation) { case RectOrientation.BottomTop: return new Rect(AnchorPanel.GetLocation_TopInside(contentSize, anchorRect, offset), contentSize); case RectOrientation.TopBottom: return new Rect(AnchorPanel.GetLocation_BottomInside(contentSize, anchorRect, offset), contentSize); case RectOrientation.RightLeft: return new Rect(AnchorPanel.GetLocation_LeftInside(contentSize, anchorRect, offset), contentSize); default: return new Rect(AnchorPanel.GetLocation_RightInside(contentSize, anchorRect, offset), contentSize); } case ContentPositions.OutsideBase: switch (anchorRectOrientation) { case RectOrientation.BottomTop: return new Rect(AnchorPanel.GetLocation_BottomOutside(contentSize, anchorRect, offset), contentSize); case RectOrientation.TopBottom: return new Rect(AnchorPanel.GetLocation_TopOutside(contentSize, anchorRect, offset), contentSize); case RectOrientation.RightLeft: return new Rect(AnchorPanel.GetLocation_RightOutside(contentSize, anchorRect, offset), contentSize); default: return new Rect(AnchorPanel.GetLocation_LeftOutside(contentSize, anchorRect, offset), contentSize); } case ContentPositions.OutsideEnd: switch (anchorRectOrientation) { case RectOrientation.BottomTop: return new Rect(AnchorPanel.GetLocation_TopOutside(contentSize, anchorRect, offset), contentSize); case RectOrientation.TopBottom: return new Rect(AnchorPanel.GetLocation_BottomOutside(contentSize, anchorRect, offset), contentSize); case RectOrientation.RightLeft: return new Rect(AnchorPanel.GetLocation_LeftOutside(contentSize, anchorRect, offset), contentSize); default: return new Rect(AnchorPanel.GetLocation_RightOutside(contentSize, anchorRect, offset), contentSize); } case ContentPositions.InsideCenter: switch (anchorRectOrientation) { case RectOrientation.BottomTop: case RectOrientation.TopBottom: return new Rect(AnchorPanel.GetLocation_MiddleVertical(contentSize, anchorRect, offset), contentSize); default: return new Rect(AnchorPanel.GetLocation_MiddleHorizontal(contentSize, anchorRect, offset), contentSize); } case ContentPositions.InsideBase: switch (anchorRectOrientation) { case RectOrientation.BottomTop: return new Rect(AnchorPanel.GetLocation_BottomInside(contentSize, anchorRect, offset), contentSize); case RectOrientation.TopBottom: return new Rect(AnchorPanel.GetLocation_TopInside(contentSize, anchorRect, offset), contentSize); case RectOrientation.RightLeft: return new Rect(AnchorPanel.GetLocation_RightInside(contentSize, anchorRect, offset), contentSize); default: return new Rect(AnchorPanel.GetLocation_LeftInside(contentSize, anchorRect, offset), contentSize); } default: throw new NotSupportedException("Unsupported ContentPosition."); } }
protected override void UpdateView(DataPoint dataPoint) { if (!this.IsDataPointViewVisible(dataPoint)) { return; } DateTime now = DateTime.Now; XYDataPoint xyDataPoint = dataPoint as XYDataPoint; if (xyDataPoint != null && this.CanGraph(xyDataPoint)) { DataPointView view = dataPoint.View; if (view != null) { FrameworkElement mainView = view.MainView; if (mainView != null) { bool flag = this.ChartArea.Orientation != Orientation.Horizontal; RectOrientation rectOrientation = RectOrientation.BottomTop; Point positionInAxisUnits = this.GetPositionInAxisUnits(xyDataPoint); Point point1 = new Point(Math.Round(positionInAxisUnits.X), Math.Round(positionInAxisUnits.Y)); object crossingPosition = this.Series.YAxis.Scale.ActualCrossingPosition; Point basePoint = new Point(positionInAxisUnits.X, this.Series.YAxis.AxisPresenter.ConvertDataToAxisUnits(crossingPosition) ?? 0.0); Point point2 = new Point(Math.Round(basePoint.X), Math.Round(basePoint.Y)); double num1 = point1.X + Math.Round(this.PointClusterOffset); double num2 = this.MinMaxScreenCoordinates(positionInAxisUnits.Y); double num3 = Math.Round(this.PointWidth); double height = this.MinMaxScreenCoordinates(basePoint.Y - positionInAxisUnits.Y); if (ValueHelper.Compare(xyDataPoint.YValue as IComparable, crossingPosition as IComparable) != 0 && Math.Abs(height) < 2.0 && this.CanAdjustHeight()) { height = basePoint.Y - positionInAxisUnits.Y >= 0.0 ? 2.0 : -2.0; num2 = point2.Y - height; } if (height < 0.0) { rectOrientation = RectOrientation.TopBottom; height = Math.Abs(height); num2 -= height; } double num4 = this.MinMaxScreenCoordinates(this.GetYOffsetInAxisUnits(xyDataPoint, positionInAxisUnits, basePoint)); double num5 = Math.Round(num2 - num4); double num6 = this.AdjustColumnHeight(height); if (flag) { if (rectOrientation == RectOrientation.BottomTop) { rectOrientation = RectOrientation.RightLeft; } else if (rectOrientation == RectOrientation.TopBottom) { rectOrientation = RectOrientation.LeftRight; } Canvas.SetLeft((UIElement)mainView, num5); Canvas.SetTop((UIElement)mainView, num1); mainView.Width = num6; mainView.Height = num3; view.AnchorRect = new Rect(num5, num1, num6, num3); view.AnchorPoint = rectOrientation != RectOrientation.RightLeft ? new Point(num5 + num6, num1 + this.PointWidth / 2.0) : new Point(num5, num1 + this.PointWidth / 2.0); } else { Canvas.SetLeft((UIElement)mainView, num1); Canvas.SetTop((UIElement)mainView, num5); mainView.Width = num3; mainView.Height = num6; view.AnchorRect = new Rect(num1, num5, num3, num6); view.AnchorPoint = rectOrientation != RectOrientation.BottomTop ? new Point(num1 + this.PointWidth / 2.0, num5 + num6) : new Point(num1 + this.PointWidth / 2.0, num5); } BarControl barControl = mainView as BarControl; if (barControl != null) { barControl.Orientation = rectOrientation; } view.AnchorRectOrientation = rectOrientation; } } } base.UpdateView(dataPoint); if (this.ChartArea == null) { return; } this.ChartArea.UpdateSession.AddCounter("ColumnSeriesPresenter.UpdateView", DateTime.Now - now); }
public static void SetAnchorRectOrientation(UIElement element, RectOrientation anchorRectOrientation) { if (element == null) throw new ArgumentNullException("element"); element.SetValue(AnchorPanel.AnchorRectOrientationProperty, (object)anchorRectOrientation); }
public static extern int imaqUnwrapImage(IntPtr dest, IntPtr source, Annulus annulus, RectOrientation orientation, InterpolationMethod method);