Exemplo n.º 1
0
        internal void UpdateActualPlottingYValueRange()
        {
            double min = !this.Owner.YMinimum.IsNaN() ? this.Owner.YMinimum : this.GlobalValueRange.MinY;
            double max = !this.Owner.YMaximum.IsNaN() ? this.Owner.YMaximum : this.GlobalValueRange.MaxY;

            if (min.IsNaN() && max.IsNaN())
            {
                this.YPlottingRange = PlottingRange.Empty;
                return;
            }
            Range actualRange = GetProperPlottingYRange(new Range(min, max));

            this.YPlottingRange = PlottingRangeHelper.PlottingRange(actualRange, this.Owner.YValuePadding);
        }
Exemplo n.º 2
0
        internal void UpdateActualPlottingXValueRange()
        {
            double min = !this.Owner.XMinimum.IsNaN() ? this.Owner.XMinimum : this.GlobalValueRange.MinX;
            double max = !this.Owner.XMaximum.IsNaN() ? this.Owner.XMaximum : this.GlobalValueRange.MaxX;

            if (min.IsNaN() && max.IsNaN())
            {
                this.XPlottingRange = PlottingRange.Empty;
                return;
            }

            Range actualRange = new Range(min, max);

            this.XPlottingRange = PlottingRangeHelper.PlottingRange(actualRange, this.Owner.XValuePadding);
        }
Exemplo n.º 3
0
        private Range GetProperPlottingYRange(Range newRange)
        {
            switch (this.StackMode)
            {
            case StackMode.NotStacked:
                return(newRange);

            case StackMode.Stacked:
                return(new Range(0.00, newRange.Max));

            case StackMode.Stacked100:
                return(new Range(0.00, 1.00));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Range range = (Range)value;

            return(new Point(range.Min, range.Max));
        }
Exemplo n.º 5
0
        private PlottingRangeBase GetPlottingSettings(AxisType orientation)
        {
            if (this.Part_SeriesCollectionControl == null)
            {
                return(null);
            }

            Range          plottingDataRange, valuePadding;
            IList <object> plottingItemValues = null;
            bool           isCategory;

            switch (orientation)
            {
            case AxisType.X:
                if (this.XAxis == null)
                {
                    return(null);
                }
                valuePadding = new Range(this.XValuePadding.X, this.XValuePadding.Y);

                isCategory        = this.XAxis is ICategoryAxis;
                plottingDataRange = this.Part_SeriesCollectionControl.XPlottingRange.ActualRange;

                var sr = this.Part_SeriesCollectionControl.GetSeries().FirstOrDefault();

                if (sr?.ItemsSource == null)
                {
                    return(null);
                }
                plottingItemValues = sr.ItemsSource.OfType <object>().Select(x => sr.GetXPropertyObjectForItem(x))
                                     .ToArray();
                break;


            case AxisType.Y:
                if (this.YAxis == null)
                {
                    return(null);
                }
                valuePadding      = new Range(this.YValuePadding.X, this.YValuePadding.Y);
                isCategory        = this.YAxis is ICategoryAxis;
                plottingDataRange = this.Part_SeriesCollectionControl.YPlottingRange.ActualRange;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(orientation), orientation, null);
            }

            if (!plottingDataRange.IsInvalid)
            {
                if (isCategory)
                {
                    if (plottingItemValues == null ||
                        plottingItemValues.Count == 0 ||
                        plottingItemValues.Count != plottingItemValues.Distinct().Count())
                    {
                        return(null);
                    }

                    return(new CategoryPlottingRange(plottingItemValues, valuePadding));
                }
                else
                {
                    return(new NumericPlottingRange(plottingDataRange, valuePadding));
                }
            }

            return(null);
        }
Exemplo n.º 6
0
 private void SeriesCollectionControl_ActualXPlottingRangeChanged(Range obj)
 {
     this.TryUpdatePlottingSettings(AxisType.X);
 }