コード例 #1
0
        public virtual double GetMaxValue(int axis, bool dataValue)
        {
            if (dataValue == false)
            {
                if (axis == 0 && automaticHorizontalView == false)
                {
                    return(HorizontalViewOrigin + Math.Max(0.001f, horizontalViewSize));
                }
                if (axis == 1 && AutomaticVerticallView == false)
                {
                    return(VerticalViewOrigin + Math.Max(0.001f, verticalViewSize));
                }
            }
            double?res = null;
            double add = 0;

            foreach (BaseScrollableCategoryData cat in mData.Values)
            {
                if (cat.MaxRadius.HasValue && add < cat.MaxRadius)
                {
                    add = cat.MaxRadius.Value;
                }
                if (axis == 0)
                {
                    if (res.HasValue == false || (cat.MaxX.HasValue && res.Value < cat.MaxX))
                    {
                        res = cat.MaxX;
                    }
                }
                else
                {
                    if (res.HasValue == false || (cat.MaxY.HasValue && res.Value < cat.MaxY))
                    {
                        res = cat.MaxY;
                    }
                }
            }
            for (int i = 0; i < mSliders.Count; i++)
            {
                BaseSlider s = mSliders[i];
                if (axis == 0)
                {
                    res = ChartCommon.Max(res, s.Max.x);
                }
                else
                {
                    res = ChartCommon.Max(res, s.Max.y);
                }
            }
            if (res.HasValue == false)
            {
                return(10f);
            }
            double gap = (axis == 0) ? automaticcHorizontaViewGap : automaticVerticalViewGap;

            return(res.Value + add + gap);
        }
        public virtual double GetMinValue(int axis, bool dataValue)
        {
            if (dataValue == false)
            {
                if (axis == 0 && automaticHorizontalView == false)
                {
                    return(horizontalViewOrigin);
                }
                if (axis == 1 && AutomaticVerticallView == false)
                {
                    return(verticalViewOrigin);
                }
            }
            double?res = null;
            double add = 0f;

            foreach (BaseScrollableCategoryData cat in mData.Values)
            {
                if (cat.Enabled == false)
                {
                    continue;
                }
                if (cat.MaxRadius.HasValue && add < cat.MaxRadius)
                {
                    add = cat.MaxRadius.Value;
                }

                if (axis == 0)
                {
                    if (res.HasValue == false || (cat.MinX.HasValue && res.Value > cat.MinX))
                    {
                        res = cat.MinX;
                    }
                }
                else
                {
                    if (res.HasValue == false || (cat.MinY.HasValue && res.Value > cat.MinY))
                    {
                        res = cat.MinY;
                    }
                }
            }
            for (int i = 0; i < mSliders.Count; i++)
            {
                BaseSlider s = mSliders[i];
                if (axis == 0)
                {
                    res = ChartCommon.Min(res, s.Max.x);
                }
                else
                {
                    res = ChartCommon.Min(res, s.Max.y);
                }
            }
            if (res.HasValue == false)
            {
                return(0.0);
            }
            double max = GetMaxValue(axis, dataValue);

            if (max == res.Value)
            {
                if (res.Value == 0.0)
                {
                    return(-10.0f);
                }
                return(0.0);
            }
            double gap = (axis == 0) ? automaticcHorizontaViewGap : automaticVerticalViewGap;

            return(res.Value - add - gap);
        }