コード例 #1
0
        /// <summary>
        /// Get value from custom attribute BubbleMaxSize
        /// </summary>
        /// <param name="area">Chart Area</param>
        /// <returns>Bubble Max size</returns>
        static internal double GetBubbleMaxSize(ChartArea area)
        {
            double maxPossibleBubbleSize = 15;

            // Try to find bubble size scale in the custom series properties
            foreach (Series ser in area.Common.DataManager.Series)
            {
                if (String.Compare(ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0 &&
                    ser.ChartArea == area.Name &&
                    ser.IsVisible())
                {
                    // Check if attribute for max. size is set
                    if (ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
                    {
                        maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
                        if (maxPossibleBubbleSize < 0 || maxPossibleBubbleSize > 100)
                        {
                            throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
                        }
                    }
                }
            }

            return(maxPossibleBubbleSize / 100);
        }
コード例 #2
0
        /// <summary>
        /// Overrides the ConvertFrom method of TypeConverter.
        /// </summary>
        /// <param name="context">Descriptor context.</param>
        /// <param name="culture">Culture information.</param>
        /// <param name="value">Value to convert from.</param>
        /// <returns>Converted object.</returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            object result          = null;
            bool   convertFromDate = false;

            // Try to check if value type is date
            if (context != null && context.Instance != null)
            {
                DataPoint dataPoint = (DataPoint)context.Instance;
                if (dataPoint.series != null && dataPoint.series.IsYValueDateTime())
                {
                    convertFromDate = true;
                }
            }

            // Can convert from string where each array element is separated by comma
            string stringValue = value as string;

            if (stringValue != null)
            {
                string[] values = stringValue.Split(new char[] { ',' });
                double[] array  = new double[values.Length];
                for (int index = 0; index < values.Length; index++)
                {
                    // Try to convert from date-time string format
                    if (convertFromDate)
                    {
                        DateTime valueAsDate;
                        if (DateTime.TryParse(values[index], CultureInfo.InvariantCulture, DateTimeStyles.None, out valueAsDate))
                        {
                            result = valueAsDate;
                        }
                        else if (DateTime.TryParse(values[index], CultureInfo.CurrentCulture, DateTimeStyles.None, out valueAsDate))
                        {
                            result = valueAsDate;
                        }
                        else
                        {
                            result = null;
                        }
                    }

                    // Save converted value in the array
                    if (result != null)
                    {
                        array[index] = (double)result;
                    }
                    else
                    {
                        array[index] = CommonElements.ParseDouble(values[index]);
                    }
                }

                return(array);
            }

            // Call base class
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #3
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            object obj  = null;
            bool   flag = false;

            if (context != null && context.Instance != null)
            {
                DataPoint dataPoint = (DataPoint)context.Instance;
                if (dataPoint.series != null && dataPoint.series.IsYValueDateTime())
                {
                    flag = true;
                }
            }
            if (value is string)
            {
                string[] array  = ((string)value).Split(',');
                double[] array2 = new double[array.Length];
                for (int i = 0; i < array.Length; i++)
                {
                    if (flag)
                    {
                        try
                        {
                            obj = DateTime.Parse(array[i], CultureInfo.InvariantCulture).ToOADate();
                        }
                        catch (Exception)
                        {
                            try
                            {
                                obj = DateTime.Parse(array[i], CultureInfo.CurrentCulture).ToOADate();
                            }
                            catch (Exception)
                            {
                                obj = null;
                            }
                        }
                    }
                    if (obj != null)
                    {
                        array2[i] = (double)obj;
                    }
                    else
                    {
                        array2[i] = CommonElements.ParseDouble(array[i]);
                    }
                }
                return(array2);
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #4
0
        internal static double GetBubbleMaxSize(ChartArea area)
        {
            double num = 15.0;

            foreach (Series item in area.Common.DataManager.Series)
            {
                if (string.Compare(item.ChartTypeName, "Bubble", StringComparison.OrdinalIgnoreCase) == 0 && item.ChartArea == area.Name && item.IsVisible() && item.IsAttributeSet("BubbleMaxSize"))
                {
                    num = CommonElements.ParseDouble(item["BubbleMaxSize"]);
                    if (num < 0.0 || num > 100.0)
                    {
                        throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize"));
                    }
                }
            }
            return(num / 100.0);
        }
コード例 #5
0
        /// <summary>
        /// Scales the value used to determine the size of the Bubble.
        /// </summary>
        /// <param name="common">The Common elements object</param>
        /// <param name="area">Chart area for this chart</param>
        /// <param name="value">Value to scale.</param>
        /// <param name="yValue">True if Y value is calculated, false if X.</param>
        /// <returns>Scaled values.</returns>
        static internal double AxisScaleBubbleSize(CommonElements common, ChartArea area, double value, bool yValue)
        {
            // Try to find bubble size scale in the custom series properties
            double minAll = double.MaxValue;
            double maxAll = double.MinValue;
            double maxPossibleBubbleSize = 15F;
            double minPossibleBubbleSize = 3F;
            float  maxBubleSize;
            float  minBubleSize;
            double valueScale;
            double valueDiff;

            foreach (Series ser in common.DataManager.Series)
            {
                if (String.Compare(ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0 &&
                    ser.ChartArea == area.Name &&
                    ser.IsVisible())
                {
                    // Check if custom properties are set to specify scale
                    if (ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMin))
                    {
                        minAll = Math.Min(minAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMin]));
                    }
                    if (ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMax))
                    {
                        maxAll = Math.Max(maxAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMax]));
                    }

                    // Check if attribute for max. size is set
                    if (ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
                    {
                        maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
                        if (maxPossibleBubbleSize < 0 || maxPossibleBubbleSize > 100)
                        {
                            throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
                        }
                    }

                    // Check if custom properties set to use second Y value (bubble size) as label text
                    if (ser.IsCustomPropertySet(CustomPropertyName.BubbleUseSizeForLabel))
                    {
                        if (String.Compare(ser[CustomPropertyName.BubbleUseSizeForLabel], "true", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            break;
                        }
                    }
                }
            }

            // Scale values are not specified - auto detect
            double minimum = double.MaxValue;
            double maximum = double.MinValue;
            double minSer  = double.MaxValue;
            double maxSer  = double.MinValue;

            foreach (Series ser in common.DataManager.Series)
            {
                if (String.Compare(ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0 &&
                    ser.ChartArea == area.Name &&
                    ser.IsVisible())
                {
                    foreach (DataPoint point in ser.Points)
                    {
                        if (!point.IsEmpty)
                        {
                            minSer = Math.Min(minSer, point.YValues[1]);
                            maxSer = Math.Max(maxSer, point.YValues[1]);

                            if (yValue)
                            {
                                minimum = Math.Min(minimum, point.YValues[0]);
                                maximum = Math.Max(maximum, point.YValues[0]);
                            }
                            else
                            {
                                minimum = Math.Min(minimum, point.XValue);
                                maximum = Math.Max(maximum, point.XValue);
                            }
                        }
                    }
                }
            }
            if (minAll == double.MaxValue)
            {
                minAll = minSer;
            }
            if (maxAll == double.MinValue)
            {
                maxAll = maxSer;
            }

            // Calculate maximum bubble size
            maxBubleSize = (float)((maximum - minimum) / (100.0 / maxPossibleBubbleSize));
            minBubleSize = (float)((maximum - minimum) / (100.0 / minPossibleBubbleSize));

            // Calculate scaling variables depending on the Min/Max values
            if (maxAll == minAll)
            {
                valueScale = 1;
                valueDiff  = minAll - (maxBubleSize - minBubleSize) / 2f;
            }
            else
            {
                valueScale = (maxBubleSize - minBubleSize) / (maxAll - minAll);
                valueDiff  = minAll;
            }


            // Check if value do not exceed Min&Max
            if (value > maxAll)
            {
                return(0F);
            }
            if (value < minAll)
            {
                return(0F);
            }

            // Return scaled value
            return((float)((value - valueDiff) * valueScale) + minBubleSize);
        }
コード例 #6
0
        /// <summary>
        /// Scales the value used to determine the size of the Bubble.
        /// </summary>
        /// <param name="graph">The Chart Graphics object</param>
        /// <param name="common">The Common elements object</param>
        /// <param name="area">Chart area for this chart</param>
        /// <param name="value">Value to scale.</param>
        /// <returns>Scaled values.</returns>
        private float ScaleBubbleSize(ChartGraphics graph, CommonElements common, ChartArea area, double value)
        {
            // Check if scaling numbers are detected
            if (!_scaleDetected)
            {
                // Try to find bubble size scale in the custom series properties
                _minAll = double.MaxValue;
                _maxAll = double.MinValue;
                foreach (Series ser in common.DataManager.Series)
                {
                    if (String.Compare(ser.ChartTypeName, this.Name, true, System.Globalization.CultureInfo.CurrentCulture) == 0 &&
                        ser.ChartArea == area.Name &&
                        ser.IsVisible())
                    {
                        // Check if custom properties are set to specify scale
                        if (ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMin))
                        {
                            _minAll = Math.Min(_minAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMin]));
                        }
                        if (ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMax))
                        {
                            _maxAll = Math.Max(_maxAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMax]));
                        }

                        // Check if attribute for max. size is set
                        if (ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
                        {
                            _maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
                            if (_maxPossibleBubbleSize < 0 || _maxPossibleBubbleSize > 100)
                            {
                                throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
                            }
                        }

                        // Check if attribute for min. size is set
                        if (ser.IsCustomPropertySet(CustomPropertyName.BubbleMinSize))
                        {
                            _minPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMinSize]);
                            if (_minPossibleBubbleSize < 0 || _minPossibleBubbleSize > 100)
                            {
                                throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMinSize")));
                            }
                        }


                        // Check if custom properties set to use second Y value (bubble size) as label text
                        labelYValueIndex = 0;
                        if (ser.IsCustomPropertySet(CustomPropertyName.BubbleUseSizeForLabel))
                        {
                            if (String.Compare(ser[CustomPropertyName.BubbleUseSizeForLabel], "true", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                labelYValueIndex = 1;
                                break;
                            }
                        }
                    }
                }

                // Scale values are not specified - auto detect
                if (_minAll == double.MaxValue || _maxAll == double.MinValue)
                {
                    double minSer = double.MaxValue;
                    double maxSer = double.MinValue;
                    foreach (Series ser in common.DataManager.Series)
                    {
                        if (ser.ChartTypeName == this.Name && ser.ChartArea == area.Name && ser.IsVisible())
                        {
                            foreach (DataPoint point in ser.Points)
                            {
                                if (!point.IsEmpty)
                                {
                                    // Check required Y values number
                                    if (point.YValues.Length < this.YValuesPerPoint)
                                    {
                                        throw (new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(this.Name, this.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))));
                                    }

                                    minSer = Math.Min(minSer, point.YValues[1]);
                                    maxSer = Math.Max(maxSer, point.YValues[1]);
                                }
                            }
                        }
                    }
                    if (_minAll == double.MaxValue)
                    {
                        _minAll = minSer;
                    }
                    if (_maxAll == double.MinValue)
                    {
                        _maxAll = maxSer;
                    }
                }

                // Calculate maximum bubble size
                SizeF areaSize = graph.GetAbsoluteSize(area.PlotAreaPosition.Size);
                _maxBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0 / _maxPossibleBubbleSize));
                _minBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0 / _minPossibleBubbleSize));

                // Calculate scaling variables depending on the Min/Max values
                if (_maxAll == _minAll)
                {
                    this._valueScale = 1;
                    this._valueDiff  = _minAll - (_maxBubleSize - _minBubleSize) / 2f;
                }
                else
                {
                    this._valueScale = (_maxBubleSize - _minBubleSize) / (_maxAll - _minAll);
                    this._valueDiff  = _minAll;
                }

                _scaleDetected = true;
            }

            // Check if value do not exceed Min&Max
            if (value > _maxAll)
            {
                return(0F);
            }
            if (value < _minAll)
            {
                return(0F);
            }

            // Return scaled value
            return((float)((value - this._valueDiff) * this._valueScale) + _minBubleSize);
        }
コード例 #7
0
 private float ScaleBubbleSize(ChartGraphics graph, CommonElements common, ChartArea area, double value)
 {
     if (!scaleDetected)
     {
         minAll = double.MaxValue;
         maxAll = double.MinValue;
         foreach (Series item in common.DataManager.Series)
         {
             if (string.Compare(item.ChartTypeName, Name, ignoreCase: true, CultureInfo.CurrentCulture) != 0 || !(item.ChartArea == area.Name) || !item.IsVisible())
             {
                 continue;
             }
             if (item.IsAttributeSet("BubbleScaleMin"))
             {
                 minAll = Math.Min(minAll, CommonElements.ParseDouble(item["BubbleScaleMin"]));
             }
             if (item.IsAttributeSet("BubbleScaleMax"))
             {
                 maxAll = Math.Max(maxAll, CommonElements.ParseDouble(item["BubbleScaleMax"]));
             }
             if (item.IsAttributeSet("BubbleMaxSize"))
             {
                 maxPossibleBubbleSize = CommonElements.ParseDouble(item["BubbleMaxSize"]);
                 if (maxPossibleBubbleSize < 0.0 || maxPossibleBubbleSize > 100.0)
                 {
                     throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize"));
                 }
             }
             if (item.IsAttributeSet("BubbleMinSize"))
             {
                 minPossibleBubbleSize = CommonElements.ParseDouble(item["BubbleMinSize"]);
                 if (minPossibleBubbleSize < 0.0 || minPossibleBubbleSize > 100.0)
                 {
                     throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMinSize"));
                 }
             }
             labelYValueIndex = 0;
             if (item.IsAttributeSet("BubbleUseSizeForLabel") && string.Compare(item["BubbleUseSizeForLabel"], "true", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 labelYValueIndex = 1;
                 break;
             }
         }
         if (minAll == double.MaxValue || maxAll == double.MinValue)
         {
             double val  = double.MaxValue;
             double val2 = double.MinValue;
             foreach (Series item2 in common.DataManager.Series)
             {
                 if (!(item2.ChartTypeName == Name) || !(item2.ChartArea == area.Name) || !item2.IsVisible())
                 {
                     continue;
                 }
                 foreach (DataPoint point in item2.Points)
                 {
                     if (!point.Empty)
                     {
                         if (point.YValues.Length < YValuesPerPoint)
                         {
                             throw new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(Name, YValuesPerPoint.ToString(CultureInfo.InvariantCulture)));
                         }
                         val  = Math.Min(val, point.YValues[1]);
                         val2 = Math.Max(val2, point.YValues[1]);
                     }
                 }
             }
             if (minAll == double.MaxValue)
             {
                 minAll = val;
             }
             if (maxAll == double.MinValue)
             {
                 maxAll = val2;
             }
         }
         SizeF absoluteSize = graph.GetAbsoluteSize(area.PlotAreaPosition.GetSize());
         maxBubleSize = (float)((double)Math.Min(absoluteSize.Width, absoluteSize.Height) / (100.0 / maxPossibleBubbleSize));
         minBubleSize = (float)((double)Math.Min(absoluteSize.Width, absoluteSize.Height) / (100.0 / minPossibleBubbleSize));
         if (maxAll == minAll)
         {
             valueScale = 1.0;
             valueDiff  = minAll - (double)((maxBubleSize - minBubleSize) / 2f);
         }
         else
         {
             valueScale = (double)(maxBubleSize - minBubleSize) / (maxAll - minAll);
             valueDiff  = minAll;
         }
         scaleDetected = true;
     }
     if (value > maxAll)
     {
         return(0f);
     }
     if (value < minAll)
     {
         return(0f);
     }
     return((float)((value - valueDiff) * valueScale) + minBubleSize);
 }
コード例 #8
0
        internal static double AxisScaleBubbleSize(ChartGraphics graph, CommonElements common, ChartArea area, double value, bool yValue)
        {
            double num  = double.MaxValue;
            double num2 = double.MinValue;
            double num3 = 15.0;
            double num4 = 3.0;

            foreach (Series item in common.DataManager.Series)
            {
                if (string.Compare(item.ChartTypeName, "Bubble", StringComparison.OrdinalIgnoreCase) != 0 || !(item.ChartArea == area.Name) || !item.IsVisible())
                {
                    continue;
                }
                if (item.IsAttributeSet("BubbleScaleMin"))
                {
                    num = Math.Min(num, CommonElements.ParseDouble(item["BubbleScaleMin"]));
                }
                if (item.IsAttributeSet("BubbleScaleMax"))
                {
                    num2 = Math.Max(num2, CommonElements.ParseDouble(item["BubbleScaleMax"]));
                }
                if (item.IsAttributeSet("BubbleMaxSize"))
                {
                    num3 = CommonElements.ParseDouble(item["BubbleMaxSize"]);
                    if (num3 < 0.0 || num3 > 100.0)
                    {
                        throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize"));
                    }
                }
                if (item.IsAttributeSet("BubbleUseSizeForLabel") && string.Compare(item["BubbleUseSizeForLabel"], "true", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    break;
                }
            }
            double num5 = double.MaxValue;
            double num6 = double.MinValue;
            double num7 = double.MaxValue;
            double num8 = double.MinValue;

            foreach (Series item2 in common.DataManager.Series)
            {
                if (string.Compare(item2.ChartTypeName, "Bubble", StringComparison.OrdinalIgnoreCase) != 0 || !(item2.ChartArea == area.Name) || !item2.IsVisible())
                {
                    continue;
                }
                foreach (DataPoint point in item2.Points)
                {
                    if (!point.Empty)
                    {
                        num7 = Math.Min(num7, point.YValues[1]);
                        num8 = Math.Max(num8, point.YValues[1]);
                        if (yValue)
                        {
                            num5 = Math.Min(num5, point.YValues[0]);
                            num6 = Math.Max(num6, point.YValues[0]);
                        }
                        else
                        {
                            num5 = Math.Min(num5, point.XValue);
                            num6 = Math.Max(num6, point.XValue);
                        }
                    }
                }
            }
            if (num == double.MaxValue)
            {
                num = num7;
            }
            if (num2 == double.MinValue)
            {
                num2 = num8;
            }
            graph.GetAbsoluteSize(area.PlotAreaPosition.GetSize());
            float  num9  = (float)((num6 - num5) / (100.0 / num3));
            float  num10 = (float)((num6 - num5) / (100.0 / num4));
            double num11;
            double num12;

            if (num2 == num)
            {
                num11 = 1.0;
                num12 = num - (double)((num9 - num10) / 2f);
            }
            else
            {
                num11 = (double)(num9 - num10) / (num2 - num);
                num12 = num;
            }
            if (value > num2)
            {
                return(0.0);
            }
            if (value < num)
            {
                return(0.0);
            }
            return((float)((value - num12) * num11) + num10);
        }
コード例 #9
0
        private float ScaleBubbleSize(ChartGraphics graph, CommonElements common, ChartArea area, double value)
        {
            if (!this.scaleDetected)
            {
                this.minAll = 1.7976931348623157E+308;
                this.maxAll = -1.7976931348623157E+308;
                foreach (Series item in common.DataManager.Series)
                {
                    if (string.Compare(item.ChartTypeName, this.Name, true, CultureInfo.CurrentCulture) == 0 && item.ChartArea == area.Name && item.IsVisible())
                    {
                        if (item.IsAttributeSet("BubbleScaleMin"))
                        {
                            this.minAll = Math.Min(this.minAll, CommonElements.ParseDouble(((DataPointAttributes)item)["BubbleScaleMin"]));
                        }
                        if (item.IsAttributeSet("BubbleScaleMax"))
                        {
                            this.maxAll = Math.Max(this.maxAll, CommonElements.ParseDouble(((DataPointAttributes)item)["BubbleScaleMax"]));
                        }
                        if (item.IsAttributeSet("BubbleMaxSize"))
                        {
                            this.maxPossibleBubbleSize = CommonElements.ParseDouble(((DataPointAttributes)item)["BubbleMaxSize"]);
                            if (!(this.maxPossibleBubbleSize < 0.0) && !(this.maxPossibleBubbleSize > 100.0))
                            {
                                goto IL_013b;
                            }
                            throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize"));
                        }
                        goto IL_013b;
                    }
                    continue;
IL_013b:
                    if (item.IsAttributeSet("BubbleMinSize"))
                    {
                        this.minPossibleBubbleSize = CommonElements.ParseDouble(((DataPointAttributes)item)["BubbleMinSize"]);
                        if (!(this.minPossibleBubbleSize < 0.0) && !(this.minPossibleBubbleSize > 100.0))
                        {
                            goto IL_0190;
                        }
                        throw new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMinSize"));
                    }
                    goto IL_0190;
IL_0190:
                    base.labelYValueIndex = 0;
                    if (item.IsAttributeSet("BubbleUseSizeForLabel") && string.Compare(((DataPointAttributes)item)["BubbleUseSizeForLabel"], "true", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        base.labelYValueIndex = 1;
                        break;
                    }
                }
                if (this.minAll == 1.7976931348623157E+308 || this.maxAll == -1.7976931348623157E+308)
                {
                    double val  = 1.7976931348623157E+308;
                    double val2 = -1.7976931348623157E+308;
                    foreach (Series item2 in common.DataManager.Series)
                    {
                        if (item2.ChartTypeName == this.Name && item2.ChartArea == area.Name && item2.IsVisible())
                        {
                            foreach (DataPoint point in item2.Points)
                            {
                                if (!point.Empty)
                                {
                                    if (point.YValues.Length < this.YValuesPerPoint)
                                    {
                                        throw new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(this.Name, this.YValuesPerPoint.ToString(CultureInfo.InvariantCulture)));
                                    }
                                    val  = Math.Min(val, point.YValues[1]);
                                    val2 = Math.Max(val2, point.YValues[1]);
                                }
                            }
                        }
                    }
                    if (this.minAll == 1.7976931348623157E+308)
                    {
                        this.minAll = val;
                    }
                    if (this.maxAll == -1.7976931348623157E+308)
                    {
                        this.maxAll = val2;
                    }
                }
                SizeF absoluteSize = graph.GetAbsoluteSize(area.PlotAreaPosition.GetSize());
                this.maxBubleSize = (float)((double)Math.Min(absoluteSize.Width, absoluteSize.Height) / (100.0 / this.maxPossibleBubbleSize));
                this.minBubleSize = (float)((double)Math.Min(absoluteSize.Width, absoluteSize.Height) / (100.0 / this.minPossibleBubbleSize));
                if (this.maxAll == this.minAll)
                {
                    this.valueScale = 1.0;
                    this.valueDiff  = this.minAll - (this.maxBubleSize - this.minBubleSize) / 2.0;
                }
                else
                {
                    this.valueScale = (double)(this.maxBubleSize - this.minBubleSize) / (this.maxAll - this.minAll);
                    this.valueDiff  = this.minAll;
                }
                this.scaleDetected = true;
            }
            if (value > this.maxAll)
            {
                return(0f);
            }
            if (value < this.minAll)
            {
                return(0f);
            }
            return((float)((value - this.valueDiff) * this.valueScale) + this.minBubleSize);
        }