예제 #1
0
        private void CalculateFirstScale()
        {
            if (0 == Preferences.YFixMin && 0 == Preferences.YFixMin && 0 == Preferences.YFixDiv)
            {
                if (FirstScale == null)
                {
                    var realMin = GetMin();
                    var realMax = GetMax();
                    var req     = new BrickRequest {
                        SourceMinValue = realMin,
                        SourceMaxValue = realMax
                    };
                    req.Setup(Preferences.Y, Preferences.YMin, Preferences.YMax, Preferences.YTop.ToString(), Preferences.YSignDelta.ToString());
                    var cat    = new BrickCatalog();
                    var result = cat.GetBestVariant(req);
                    FirstScale = new Scale {
                        Prepared = true, Min = result.ResultMinValue, Max = result.ResultMaxValue, DivLines = result.ResultDivCount
                    };
                }

                FirstScale.ValueInPixel = BrickDataSetHelper.GetValuesInPixel(FirstScale.Min, FirstScale.Max, Preferences.Height);
            }
            else
            {
                FirstScale = new Scale();
            }
        }
예제 #2
0
        private void CalculateSecondScale()
        {
            if (0 == Preferences.SYFixMin && 0 == Preferences.SYFixMin && 0 == Preferences.SYFixDiv)
            {
                var realMin = GetMin(ScaleType.Second);
                var realMax = GetMax(ScaleType.Second);
                var req     = new BrickRequest {
                    SourceMinValue = realMin, SourceMaxValue = realMax
                };
                req.Setup(Preferences.SY, Preferences.SYMin, Preferences.SYMax, Preferences.SYTop.ToString(), Preferences.SYSignDelta.ToString());
                var cat    = new BrickCatalog();
                var result = cat.GetBestVariant(req);
                SecondScale = new Scale {
                    Prepared = true,
                    Min      = result.ResultMinValue,
                    Max      = result.ResultMaxValue,
                    DivLines = result.ResultDivCount,
                };

                SecondScale.ValueInPixel = (SecondScale.Max - SecondScale.Min) / Preferences.Height;
            }
            else
            {
                SecondScale = new Scale();
            }
        }