private static void ApplyLayoutRoundingVertical(CombinedSeries series, RangeSeriesRoundLayoutContext roundLayoutContext) { double previousStackRight = -1; RangeDataPoint firstPoint; Dictionary <double, double> normalizedValueToY = new Dictionary <double, double>(); foreach (CombineGroup group in series.Groups) { foreach (CombineStack stack in group.Stacks) { firstPoint = stack.Points[0] as RangeDataPoint; if (!firstPoint.isEmpty) { roundLayoutContext.SnapPointToGridLine(firstPoint); // Handles visual glitches that might occur between clustered range bars. RangeSeriesRoundLayoutContext.SnapNormalizedValueToPreviousY(firstPoint, normalizedValueToY); SnapLeftToPreviousRight(firstPoint, previousStackRight); previousStackRight = firstPoint.layoutSlot.Right; } else { previousStackRight = -1; } } previousStackRight = -1; } }
internal override void ApplyLayoutRounding() { RangeSeriesRoundLayoutContext info = new RangeSeriesRoundLayoutContext(this); double gapLength = CategoricalAxisModel.DefaultGapLength; ISupportGapLength axisModel = this.firstAxis as ISupportGapLength; if (axisModel == null) { axisModel = this.secondAxis as ISupportGapLength; } if (axisModel != null) { gapLength = axisModel.GapLength; } int count = this.DataPointsInternal.Count; AxisPlotDirection plotDirection = this.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical); Dictionary <double, double> normalizedValueToY = new Dictionary <double, double>(); Dictionary <double, double> normalizedValueToX = new Dictionary <double, double>(); foreach (RangeDataPoint point in this.DataPointsInternal) { if (point.isEmpty) { continue; } info.SnapPointToGridLine(point); // Handles specific scenario where range bar items from non-combined series have the same high/low value (floating point number) i.e. // the presenters should be rendered on the same horizontal/vertical pixel row/column. if (plotDirection == AxisPlotDirection.Vertical) { RangeSeriesRoundLayoutContext.SnapNormalizedValueToPreviousY(point, normalizedValueToY); } else { RangeSeriesRoundLayoutContext.SnapNormalizedValueToPreviousX(point, normalizedValueToX); } if (gapLength == 0 && point.CollectionIndex < count - 1) { DataPoint nextPoint = this.DataPointsInternal[point.CollectionIndex + 1]; info.SnapToAdjacentPointInHistogramScenario(point, nextPoint); } } }
public override void ApplyLayoutRounding(ChartAreaModel chart, CombinedSeries series) { RangeBarSeriesModel rangeSeriesModel = series.Series[0] as RangeBarSeriesModel; if (rangeSeriesModel == null) { Debug.Assert(false, "Invalid combined series."); return; } RangeSeriesRoundLayoutContext info = new RangeSeriesRoundLayoutContext(rangeSeriesModel); if (info.PlotDirection == AxisPlotDirection.Vertical) { ApplyLayoutRoundingVertical(series, info); } else { ApplyLayoutRoundingHorizontal(series, info); } }