public static void Move( this Line line, double x1, double y1, double x2, double y2, CoordinateSystem coordinateSystem) { var p1 = coordinateSystem.ToPhysical(new Point(x1, y1)); var p2 = coordinateSystem.ToPhysical(new Point(x2, y2)); line.X1 = p1.X; line.Y1 = p1.Y; line.X2 = p2.X; line.Y2 = p2.Y; }
public void PositionOnYAxis(double y, CoordinateSystem coordinateSystem) { SetLabelText(TextBlock, y); double width = TextBlock.ActualWidth; double height = TextBlock.ActualHeight; var coordinates = coordinateSystem .ToPhysical(new Point(0, y)) .Plus(new Point(-width - 2, -height / 2)); MoveLabel(TextBlock, coordinates); }
public void PositionOnXAxis(double x, CoordinateSystem coordinateSystem) { SetLabelText(TextBlock, x); double width = TextBlock.ActualWidth; var coordinates = coordinateSystem .ToPhysical(new Point(x, 0)) .OffsetX(-width / 2); if (x.EqualsWithPrecision(0)) { coordinates = coordinates.OffsetX(-width / 2 - 2); } MoveLabel(TextBlock, coordinates); }