Beispiel #1
0
        internal override void ApplyLayoutRounding()
        {
            // fit first and last ticks within axis layout slot
            AxisTickModel firstTick = this.owner.FirstTick;
            AxisTickModel lastTick  = this.owner.LastTick;

            double thickness       = this.owner.TickThickness;
            double thicknessOffset = (int)(thickness / 2);

            if (firstTick != null && RadMath.IsZero(firstTick.normalizedValue))
            {
                firstTick.layoutSlot.X = this.owner.layoutSlot.X - thicknessOffset;
            }
            if (lastTick != null && RadMath.IsOne(lastTick.normalizedValue))
            {
                double zoomWidth = this.owner.layoutSlot.Width * this.owner.GetChartArea().view.ZoomWidth;
                lastTick.layoutSlot.X = this.owner.layoutSlot.X + zoomWidth - thicknessOffset;

                // remove one additional pixel on the right (rendering along the X-axis goes from left to right)
                lastTick.layoutSlot.X--;
            }
        }
            public ValueRange <double> RoundToMajorStep(double step)
            {
                double mod;

                if (!this.userMax)
                {
                    mod = this.Maximum % step;
                    if (!RadMath.IsZero(mod))
                    {
                        if (mod > 0)
                        {
                            this.Maximum += step - mod;
                        }
                        else if (mod < 0)
                        {
                            this.Maximum += step + mod;
                        }
                    }
                }

                if (!this.userMin)
                {
                    mod = this.Minimum % step;
                    if (!RadMath.IsZero(mod))
                    {
                        if (mod > 0)
                        {
                            this.Minimum -= mod;
                        }
                        else if (mod < 0)
                        {
                            this.Minimum -= step + mod;
                        }
                    }
                }

                return(new ValueRange <double>(this.Minimum, this.Maximum));
            }
Beispiel #3
0
        internal override void ApplyLayoutRounding()
        {
            // fit first and last ticks within axis layout slot
            AxisTickModel firstTick = this.owner.FirstTick;
            AxisTickModel lastTick  = this.owner.LastTick;

            double thickness       = this.owner.TickThickness;
            double thicknessOffset = (int)(thickness / 2);

            // ensure that the first and last ticks are within axis' layout slot
            if (firstTick != null && RadMath.IsZero(firstTick.normalizedValue))
            {
                double zoomHeight = this.owner.layoutSlot.Height * this.owner.GetChartArea().view.ZoomHeight;
                firstTick.layoutSlot.Y = this.owner.layoutSlot.Y + zoomHeight - thicknessOffset;

                // remove one additional pixel at bottom (rendering along the Y-axis goes from top to bottom)
                firstTick.layoutSlot.Y--;
            }
            if (lastTick != null && RadMath.IsOne(lastTick.normalizedValue))
            {
                lastTick.layoutSlot.Y = this.owner.layoutSlot.Y - thicknessOffset;
            }
        }