internal static void SnapNormalizedValueToPreviousY(RangeDataPoint point, Dictionary <double, double> normalizedValueToY) { if (!normalizedValueToY.ContainsKey(point.numericalPlot.NormalizedLow)) { normalizedValueToY[point.numericalPlot.NormalizedLow] = point.layoutSlot.Bottom; } if (!normalizedValueToY.ContainsKey(point.numericalPlot.NormalizedHigh)) { normalizedValueToY[point.numericalPlot.NormalizedHigh] = point.layoutSlot.Y; } double difference = normalizedValueToY[point.numericalPlot.NormalizedLow] - point.layoutSlot.Bottom; point.layoutSlot.Height += difference; difference = normalizedValueToY[point.numericalPlot.NormalizedHigh] - point.layoutSlot.Y; point.layoutSlot.Y += difference; point.layoutSlot.Height -= difference; if (point.layoutSlot.Height < 0) { point.layoutSlot.Height = 0; } }
internal static void SnapNormalizedValueToPreviousX(RangeDataPoint point, Dictionary <double, double> normalizedValueToX) { if (!normalizedValueToX.ContainsKey(point.numericalPlot.NormalizedLow)) { normalizedValueToX[point.numericalPlot.NormalizedLow] = point.layoutSlot.X; } if (!normalizedValueToX.ContainsKey(point.numericalPlot.NormalizedHigh)) { normalizedValueToX[point.numericalPlot.NormalizedHigh] = point.layoutSlot.Right; } double difference = normalizedValueToX[point.numericalPlot.NormalizedLow] - point.layoutSlot.X; point.layoutSlot.X += difference; point.layoutSlot.Width -= difference; difference = normalizedValueToX[point.numericalPlot.NormalizedHigh] - point.layoutSlot.Right; point.layoutSlot.Width += difference; if (point.layoutSlot.Width < 0) { point.layoutSlot.Width = 0; } }
public void SnapPointToGridLine(RangeDataPoint point) { if (point.numericalPlot.SnapTickIndex >= 0 && point.numericalPlot.SnapTickIndex < point.numericalPlot.Axis.ticks.Count) { AxisTickModel highTick = point.numericalPlot.Axis.ticks[point.numericalPlot.SnapTickIndex]; if (RadMath.AreClose(point.numericalPlot.NormalizedHigh, (double)highTick.normalizedValue)) { if (this.PlotDirection == AxisPlotDirection.Vertical) { SnapHighToVerticalGridLine(point, highTick.layoutSlot); } else { SnapHighToHorizontalGridLine(point, highTick.layoutSlot); } } } if (point.numericalPlot.SnapBaseTickIndex >= 0 && point.numericalPlot.SnapBaseTickIndex < point.numericalPlot.Axis.ticks.Count) { AxisTickModel lowTick = point.numericalPlot.Axis.ticks[point.numericalPlot.SnapBaseTickIndex]; if (RadMath.AreClose(point.numericalPlot.NormalizedLow, (double)lowTick.normalizedValue)) { if (this.PlotDirection == AxisPlotDirection.Vertical) { SnapLowToVerticalGridLine(point, lowTick.layoutSlot); } else { SnapLowToHorizontalGridLine(point, lowTick.layoutSlot); } } } }
private static void SnapBottomToPreviousTop(RangeDataPoint firstPoint, double previousStackTop) { if (previousStackTop != -1) { double difference = previousStackTop - firstPoint.layoutSlot.Bottom; firstPoint.layoutSlot.Height += difference; } }
private static void SnapLeftToPreviousRight(RangeDataPoint firstPoint, double previousStackRight) { if (previousStackRight != -1) { double difference = previousStackRight - firstPoint.layoutSlot.X; firstPoint.layoutSlot.X += difference; firstPoint.layoutSlot.Width -= difference; } }
private static void SnapHighToHorizontalGridLine(RangeDataPoint point, RadRect tickRect) { double difference; double gridLine = tickRect.X + (int)(tickRect.Width / 2); difference = point.layoutSlot.Right - gridLine; point.layoutSlot.Width -= difference - 1; if (point.layoutSlot.Width < 0) { point.layoutSlot.Width = 0; } }
internal void SnapToAdjacentPointInHistogramScenario(RangeDataPoint point, DataPoint nextPoint) { // TODO: Fix histogram bars in scenarios with combination (multiple bar series) // NOTE: We intentionally overlap the bar layout slots with single pixel so the border of the visual does not get blurred. if (this.PlotDirection == AxisPlotDirection.Vertical) { point.layoutSlot.Width = nextPoint.layoutSlot.X - point.layoutSlot.X + 1; } else { nextPoint.layoutSlot.Height = point.layoutSlot.Y - nextPoint.layoutSlot.Y + 1; } }
private static void SnapLowToVerticalGridLine(RangeDataPoint point, RadRect tickRect) { if (point.isEmpty) { return; } double difference; double gridLine = tickRect.Y + (int)(tickRect.Height / 2); difference = point.layoutSlot.Bottom - gridLine; point.layoutSlot.Height -= difference; if (point.layoutSlot.Height < 0) { point.layoutSlot.Height = 0; } }