示例#1
0
        private void InternalCalculateMajorTicks(DateTime org, DateTime end, TimeSpanEx majorSpan)
        {
            _majorTicks.Clear();

            if (majorSpan._span.Ticks <= 0)
            {
                return;
            }

            DateTime x = majorSpan.RoundDown(org);

            while (x <= end)
            {
                if (x >= org)
                {
                    _majorTicks.Add(x);
                }

                x = TimeSpanEx.Add(x, majorSpan);
            }

            // Remove suppressed ticks
            _suppressedMajorTicks.RemoveSuppressedTicks(_majorTicks);

            if (!_additionalMajorTicks.IsEmpty)
            {
                foreach (AltaxoVariant v in _additionalMajorTicks.Values)
                {
                    _majorTicks.Add(v);
                }
            }
        }
示例#2
0
        private void InternalCalculateMajorTicks()
        {
            _majorTicks.Clear();

            var axisOrgByMajor = _cachedMajorMinor.AxisOrgByMajor;
            var axisEndByMajor = _cachedMajorMinor.AxisEndByMajor;
            var majorSpan      = _cachedMajorMinor.MajorSpan;

            double beg  = System.Math.Ceiling(axisOrgByMajor);
            double end  = System.Math.Floor(axisEndByMajor);
            double llen = end - beg;

            // limit the length to 10000 to limit the amount of space required
            llen = Math.Max(0, Math.Min(llen, _maxSafeNumberOfTicks));
            int len = (int)llen;

            for (int i = 0; i <= len; i++)
            {
                double v = (i + beg) * majorSpan;
                _majorTicks.Add(v);
            }

            // Remove suppressed ticks
            _suppressedMajorTicks.RemoveSuppressedTicks(_majorTicks);

            if (!_additionalMajorTicks.IsEmpty)
            {
                foreach (AltaxoVariant v in _additionalMajorTicks.Values)
                {
                    _majorTicks.Add(v);
                }
            }
        }
示例#3
0
        private void InternalCalculateMinorTicks()
        {
            _minorTicks.Clear();

            var axisOrgByMajor     = _cachedMajorMinor.AxisOrgByMajor;
            var axisEndByMajor     = _cachedMajorMinor.AxisEndByMajor;
            var majorSpan          = _cachedMajorMinor.MajorSpan;
            var numberOfMinorTicks = _cachedMajorMinor.MinorTicks;

            if (numberOfMinorTicks < 2)
            {
                return; // below 2 there are no minor ticks per definition
            }
            double beg        = System.Math.Ceiling(axisOrgByMajor);
            double end        = System.Math.Floor(axisEndByMajor);
            int    majorticks = 1 + (int)(end - beg);

            beg = System.Math.Ceiling(axisOrgByMajor * numberOfMinorTicks);
            end = System.Math.Floor(axisEndByMajor * numberOfMinorTicks);
            double llen = end - beg;

            // limit the length to 10000 to limit the amount of space and time required
            llen = Math.Max(0, Math.Min(llen, _maxSafeNumberOfTicks));
            int len = (int)llen;

            int shift = (int)(beg % numberOfMinorTicks);

            for (int i = 0; i <= len; i++)
            {
                if ((i + shift) % numberOfMinorTicks == 0)
                {
                    continue;
                }

                double v = (i + beg) * majorSpan / numberOfMinorTicks;
                _minorTicks.Add(v);
            }

            // Remove suppressed ticks
            _suppressedMinorTicks.RemoveSuppressedTicks(_minorTicks);

            if (!_additionalMinorTicks.IsEmpty)
            {
                foreach (AltaxoVariant v in _additionalMinorTicks.Values)
                {
                    _minorTicks.Add(v);
                }
            }
        }
示例#4
0
        private void InternalCalculateMinorTicks(DateTime org, DateTime end, TimeSpanEx majorSpan, TimeSpanEx minorSpan)
        {
            _minorTicks.Clear();

            if (majorSpan._span.Ticks <= 0)
            {
                return;
            }

            DateTime currentMajor = majorSpan.RoundDown(org);
            DateTime nextMajor    = TimeSpanEx.Add(currentMajor, majorSpan);
            DateTime x            = TimeSpanEx.Add(currentMajor, minorSpan);

            while (x <= end)
            {
                while (nextMajor <= x)
                {
                    nextMajor = TimeSpanEx.Add(nextMajor, majorSpan);
                }

                if (x >= org && x != nextMajor)
                {
                    _minorTicks.Add(x);
                }

                x = TimeSpanEx.Add(x, majorSpan);
            }

            // Remove suppressed ticks
            _suppressedMinorTicks.RemoveSuppressedTicks(_minorTicks);

            if (!_additionalMinorTicks.IsEmpty)
            {
                foreach (AltaxoVariant v in _additionalMinorTicks.Values)
                {
                    _minorTicks.Add(v);
                }
            }
        }