public CategoricalSeriesRoundLayoutContext(CategoricalSeriesModel series)
        {
            CartesianChartAreaModel cartesianChartArea = series.GetChartArea() as CartesianChartAreaModel;

            if (cartesianChartArea == null)
            {
                Debug.Assert(false, "Invalid chart area.");
                return;
            }

            this.PlotDirection   = series.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            this.PlotOrigin      = series.GetTypedValue <double>(AxisModel.PlotOriginPropertyKey, 0d);
            this.PlotArea        = cartesianChartArea.plotArea.layoutSlot;
            this.PlotArea.Width  = (int)((this.PlotArea.Width * cartesianChartArea.view.ZoomWidth) + .5);
            this.PlotArea.Height = (int)((this.PlotArea.Height * cartesianChartArea.view.ZoomHeight) + .5);

            if (this.PlotDirection == AxisPlotDirection.Vertical)
            {
                if (this.PlotOrigin == 0)
                {
                    this.PlotLine = this.PlotArea.Bottom;
                }
                else if (this.PlotOrigin == 1)
                {
                    this.PlotLine = this.PlotArea.Y;
                }
                else
                {
                    double roundError = (series.SecondAxis.majorTickCount % 2) == 0 ? 0.5 : 0;
                    this.PlotLine = this.PlotArea.Bottom - (int)((this.PlotOrigin * this.PlotArea.Height) + roundError);
                }
            }
            else
            {
                if (this.PlotOrigin == 0)
                {
                    this.PlotLine = this.PlotArea.X;
                }
                else if (this.PlotOrigin == 1)
                {
                    this.PlotLine = this.PlotArea.Right;
                }
                else
                {
                    double roundError = (series.FirstAxis.majorTickCount % 2) != 0 ? 0.5 : 0;
                    this.PlotLine = this.PlotArea.X + (int)((this.PlotOrigin * this.PlotArea.Width) + roundError);
                }
            }
        }
        public override void ApplyLayoutRounding(ChartAreaModel chart, CombinedSeries series)
        {
            CategoricalSeriesModel categoricalSeries = series.Series[0] as CategoricalSeriesModel;

            if (categoricalSeries == null)
            {
                Debug.Assert(false, "Invalid combined series.");
                return;
            }

            CategoricalSeriesRoundLayoutContext info = new CategoricalSeriesRoundLayoutContext(categoricalSeries);

            if (info.PlotDirection == AxisPlotDirection.Vertical)
            {
                ApplyLayoutRoundingVertical(series, info);
            }
            else
            {
                ApplyLayoutRoundingHorizontal(series, info);
            }
        }