Esempio n. 1
0
        public bool AjustAxis(double sourceMinimum, double SourceMaximum, out double minimum, out double maximum)
        {
            minimum = 0;
            maximum = 0;
            if (this.Points.Count == 0)
            {
                return(false);
            }
            if (this.YAxis == null)
            {
                this.YAxis = ((MapPlotModel)PlotModel).GetAxis(this.YKey);
            }
            Axis y_axis = this.YAxis;

            if (!(y_axis is IAxis))
            {
                return(false);
            }

            double cur_min = _minimum < sourceMinimum ? _minimum : sourceMinimum;
            double cur_max = _maximum > SourceMaximum ? _maximum : SourceMaximum;

            PointLineSeries.AjustYAxis(LabelVisible, TextOffset.Y, ActualFontSize, cur_min, cur_max, Scale, ((IAxis)y_axis).Bound, out maximum, out minimum);
            return(true);
        }
Esempio n. 2
0
        public override bool AjustAxis(double sourceMinimum, double SourceMaximum, out double minimum, out double maximum)
        {
            minimum = 0;
            maximum = 0;
            if (Count == 0)
                return false;

            IAxis y_axis = this.YAxis as IAxis;
            if (y_axis == null)
            {
                y_axis = ((MapPlotModel)PlotModel).GetAxis(this.YKey) as IAxis;
            }

            if (!(y_axis is IAxis))
                return false;

            double cur_min = _minimum < sourceMinimum ? _minimum : sourceMinimum;
            double cur_max = _maximum > SourceMaximum ? _maximum : SourceMaximum;
            PointLineSeries.AjustYAxis(false, TextOffset.Y, this.ActualFontSize, cur_min, cur_max, 0.15, y_axis.Bound, out maximum, out minimum, 15);
            return true;
        }
        public override bool AjustAxis(double sourceMinimum, double SourceMaximum, out double minimum, out double maximum)
        {
            minimum = 0;
            maximum = 0;
            if (Count == 0)
            {
                return(false);
            }

            IAxis y_axis = this.YAxis as IAxis;

            if (y_axis == null)
            {
                y_axis = ((MapPlotModel)PlotModel).GetAxis(this.YKey) as IAxis;
            }

            if (!(y_axis is IAxis))
            {
                return(false);
            }

            double cur_min = _minimum < sourceMinimum ? _minimum : sourceMinimum;
            double cur_max = _maximum > SourceMaximum ? _maximum : SourceMaximum;

            PointLineSeries.AjustYAxis(false, TextOffset.Y, this.ActualFontSize, cur_min, cur_max, 0.15, y_axis.Bound, out maximum, out minimum, 15);
            //maximum = cur_max;
            //minimum = cur_min;
            //double scale = 0.15;
            //if (maximum == minimum)
            //{
            //    if (maximum == 0)
            //    {
            //        minimum = -10;
            //        maximum = 10;
            //    }
            //    minimum = minimum * (1 - scale);
            //    maximum = maximum * (1 + scale);
            //    return false;
            //}

            //double font_size = this.FontSize;
            //double rest_length =y_axis.Bound.Bottom-y_axis.Bound.Top-2*font_size ;
            //OxyRect bound = y_axis.Bound;
            //if (rest_length <= 0)
            //{
            //    rest_length = (bound.Bottom - bound.Top) >font_size  ? font_size : bound.Bottom - bound.Top;
            //}

            //double max2 = font_size / rest_length * (maximum - minimum) + maximum;
            //double min2 = minimum - (maximum - minimum) *font_size / rest_length;

            //if (max2 == min2)
            //{
            //    if (min2 == 0)
            //    {
            //        min2 = -10;
            //        max2 = 10;
            //    }
            //    min2 = min2 * (1 - scale);
            //    max2 = max2 * (1 + scale);
            //}

            //minimum = min2;
            //maximum = max2;
            return(true);
        }