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); }
internal void UpdateScatterCoordinate(object item, PointNS coordinate) { var scatter = (Scatter)this.PART_ScatterItemsControl?.TryGetChildForItem(item); if (scatter != null) { scatter.Coordinate = coordinate; } }
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; } }
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; } }
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); }
public bool Equals(PointNS value) { return(PointNS.Equals(this, value)); }
public override bool Equals(object o) { return(o != null && o is PointNS point2 && PointNS.Equals(this, point2)); }
public static bool Equals(PointNS point1, PointNS point2) { return(point1.X.Equals(point2.X) && point1.Y.Equals(point2.Y)); }
private void OnCoordinateChanged(PointNS newValue) { UpdateAdjustedCoordinate(); }
public static Point ToPoint(this PointNS source) { return(new Point(source.X, source.Y)); }