Пример #1
0
        private void CalculateMajorSequence(int maxCount, double maxAllowedMargin)
        {
            switch (this.ActualMajorIntervalUnit)
            {
            case NumericScaleUnit.Number:
                this._majorSequence = NumericSequence.Calculate(this._rangeInfo, this.MajorInterval, this.MajorIntervalOffset, maxCount, this.GetMinPower(), (DoubleR10[])null, true, maxAllowedMargin);
                break;

            case NumericScaleUnit.MajorInterval:
                this._majorSequence = NumericSequence.Calculate(this._rangeInfo, new double?(), new double?(), maxCount, int.MinValue, (DoubleR10[])null, true, 1.0);
                this._majorSequence = (NumericSequence)RelativeSequence.Calculate(this._majorSequence, this.MajorInterval, this.MajorIntervalOffset, 1.0);
                break;

            case NumericScaleUnit.MinorInterval:
                this._majorSequence = (NumericSequence)RelativeSequence.Calculate(this._minorSequence, this.MajorInterval, this.MajorIntervalOffset, 5.0);
                break;
            }
        }
Пример #2
0
        private NumericSequence CalculateElementSequence(ScaleElementDefinition element, NumericScaleUnit defaultUnit)
        {
            double?interval = Scale <double, double, NumericScaleUnit> .GetInterval(element);

            double?intervalOffset = Scale <double, double, NumericScaleUnit> .GetIntervalOffset(element);

            NumericScaleUnit?intervalUnit = Scale <double, double, NumericScaleUnit> .GetIntervalUnit(element);

            NumericScaleUnit numericScaleUnit = intervalUnit.HasValue ? intervalUnit.Value : defaultUnit;
            int?maxCount1 = Scale <double, double, NumericScaleUnit> .GetMaxCount(element);

            int             maxCount2       = maxCount1.HasValue ? maxCount1.Value : this.MaxCount;
            NumericSequence numericSequence = (NumericSequence)null;

            switch (numericScaleUnit)
            {
            case NumericScaleUnit.Number:
                numericSequence = NumericSequence.Calculate(new NumericRangeInfo((DoubleR10)this.ActualViewMinimum, (DoubleR10)this.ActualViewMaximum), interval, intervalOffset, maxCount2, int.MinValue, (DoubleR10[])null, true, 1.0);
                break;

            case NumericScaleUnit.MajorInterval:
                numericSequence = interval.HasValue || intervalOffset.HasValue ? (NumericSequence)RelativeSequence.Calculate(this._majorSequence, interval, intervalOffset, 1.0) : this._majorSequence;
                break;

            case NumericScaleUnit.MinorInterval:
                numericSequence = interval.HasValue || intervalOffset.HasValue ? (NumericSequence)RelativeSequence.Calculate(this._minorSequence, interval, intervalOffset, 1.0) : this._minorSequence;
                break;
            }
            return(numericSequence);
        }
Пример #3
0
        private IEnumerable <ScalePosition> Project(IList <Category> categories, ScaleElementDefinition element, CategoryScaleUnit defaultUnit)
        {
            this.RecalculateIfEmpty();
            double?interval1 = Scale <double, double, CategoryScaleUnit> .GetInterval(element);

            double?intervalOffset = Scale <double, double, CategoryScaleUnit> .GetIntervalOffset(element);

            CategoryScaleUnit?intervalUnit = Scale <double, double, CategoryScaleUnit> .GetIntervalUnit(element);

            double            interval2         = interval1.HasValue ? interval1.Value : 1.0;
            double            num1              = intervalOffset.HasValue ? intervalOffset.Value : 0.0;
            CategoryScaleUnit categoryScaleUnit = intervalUnit.HasValue ? intervalUnit.Value : defaultUnit;
            double            num2              = defaultUnit == CategoryScaleUnit.MinorInterval ? 0.5 : 0.0;
            NumericSequence   numericSequence   = defaultUnit == CategoryScaleUnit.MinorInterval ? this._minorSequence : this._majorSequence;
            NumericSequence   sequence          = (NumericSequence)null;
            NumericRangeInfo  range             = new NumericRangeInfo((DoubleR10)this.ActualMinimum, (DoubleR10)this.ActualMaximum);

            switch (categoryScaleUnit)
            {
            case CategoryScaleUnit.Index:
                sequence = interval2 != this.ActualMajorInterval || num1 != this.ActualMinorIntervalOffset ? NumericSequence.Calculate(range, new double?(interval2), new double?(num1 + num2), 100, int.MinValue, (DoubleR10[])null, true, 1.0) : numericSequence;
                break;

            case CategoryScaleUnit.MajorInterval:
                sequence = interval2 != this.ActualMajorInterval || num1 != this.ActualMajorIntervalOffset ? (NumericSequence)RelativeSequence.Calculate(this._majorSequence, new double?(interval2), new double?(num1), 1.0) : this._majorSequence;
                break;

            case CategoryScaleUnit.MinorInterval:
                sequence = interval2 != this.ActualMinorInterval || num1 != this.ActualMinorIntervalOffset ? (NumericSequence)RelativeSequence.Calculate(this._minorSequence, new double?(interval2), new double?(num1 + 0.5), 1.0) : this._minorSequence;
                break;
            }
            return(this.Project(categories, sequence, interval2));
        }