Ejemplo n.º 1
0
        internal override void ApplyLayoutRounding()
        {
            CategoricalSeriesRoundLayoutContext info = new CategoricalSeriesRoundLayoutContext(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;

            foreach (CategoricalDataPoint point in this.DataPointsInternal)
            {
                info.SnapPointToPlotLine(point);
                info.SnapPointToGridLine(point);

                if (gapLength == 0 && point.CollectionIndex < count - 1)
                {
                    DataPoint nextPoint = this.DataPointsInternal[point.CollectionIndex + 1];
                    info.SnapToAdjacentPointInHistogramScenario(point, nextPoint);
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }