Esempio n. 1
0
        public PointNS GetPlotCoordinateForItem(object item, int itemIndex)
        {
            double x;

            if (!this.Owner.IsXAxisCategory)
            {
                x = GetXValueForItem(item);
            }
            else
            {
                x = itemIndex + 0.5;
            }

            var y = GetAdjustYValueForItem(item, itemIndex);

            var pt = new PointNS((x - this.PlottingXValueRange.Min) * this.XPixelPerUnit,
                                 (y - this.PlottingYValueRange.Min) * this.YPixelPerUnit);


            if (pt.Y < 0)
            {
                throw new NotImplementedException(this.DataContext.ToString());
            }

            return(pt);
        }
Esempio n. 2
0
        internal void UpdateScatterCoordinate(object item, PointNS coordinate)
        {
            var scatter = (Scatter)this.PART_ScatterItemsControl?.TryGetChildForItem(item);

            if (scatter != null)
            {
                scatter.Coordinate = coordinate;
            }
        }
Esempio n. 3
0
        internal void UpdateBarCoordinateAndHeight(object item, PointNS coordinate, double previousYCoordinate)
        {
            var barItem = (BarItem)this.PART_BarItemsControl?.TryGetChildForItem(item);

            if (barItem != null)
            {
                var barHeight = coordinate.Y - previousYCoordinate;

                barItem.SetBarHeight(barHeight);

                barItem.Coordinate = coordinate;
            }
        }
Esempio n. 4
0
        private void UpdateAdjustedCoordinate()
        {
            if (this.Coordinate.IsEmpty())
            {
                return;
            }


            PointNS offset = GetOffsetForSizeChangedOverride();

            if (offset.IsEmpty())
            {
                return;
            }

            var x = this.Coordinate.X + offset.X;
            var y = this.Coordinate.Y + offset.Y;


            //if (!double.IsInfinity(x))
            //{
            //    Canvas.SetLeft(this, x);
            //}

            //if (!double.IsInfinity(y))
            //{
            //    Canvas.SetTop(this, y);
            //}

            var translateTransform = this.RenderTransform as TranslateTransform;

            if (translateTransform == null)
            {
                this.RenderTransform = new TranslateTransform(x, y);
            }
            else
            {
                translateTransform.Y = y;
                translateTransform.X = x;
            }
        }
Esempio n. 5
0
        private static PointNS[] ConvertToStepPoints(PointNS[] points)
        {
            if (points == null)
            {
                return(null);
            }
            var arr = new PointNS[points.Length + (points.Length - 1)];

            int j = 0;

            for (int i = 0; i < points.Length; i++)
            {
                arr[j++] = points[i];

                if (i < points.Length - 1)
                {
                    arr[j++] = new PointNS(points[i + 1].X, points[i].Y);
                }
            }

            return(arr);
        }
Esempio n. 6
0
 public bool Equals(PointNS value)
 {
     return(PointNS.Equals(this, value));
 }
Esempio n. 7
0
 public override bool Equals(object o)
 {
     return(o != null && o is PointNS point2 && PointNS.Equals(this, point2));
 }
Esempio n. 8
0
 public static bool Equals(PointNS point1, PointNS point2)
 {
     return(point1.X.Equals(point2.X) && point1.Y.Equals(point2.Y));
 }
Esempio n. 9
0
 private void OnCoordinateChanged(PointNS newValue)
 {
     UpdateAdjustedCoordinate();
 }
Esempio n. 10
0
 public static Point ToPoint(this PointNS source)
 {
     return(new Point(source.X, source.Y));
 }