Exemplo n.º 1
0
        internal override void AdjustDataPointLabelVisibilityRating(LabelVisibilityManager.DataPointRange range, Dictionary <XYDataPoint, double> dataPointRanks)
        {
            BubbleDataPoint bubbleDataPoint1 = (BubbleDataPoint)null;
            double          num = double.MinValue;

            foreach (XYDataPoint xyDataPoint in range.DataPoints)
            {
                BubbleDataPoint bubbleDataPoint2 = xyDataPoint as BubbleDataPoint;
                if (bubbleDataPoint2 != null && bubbleDataPoint2.SizeValueInScaleUnitsWithoutAnimation > num)
                {
                    num = bubbleDataPoint2.SizeValueInScaleUnitsWithoutAnimation;
                    bubbleDataPoint1 = bubbleDataPoint2;
                }
            }
            if (bubbleDataPoint1 == null)
            {
                return;
            }
            if (dataPointRanks.ContainsKey((XYDataPoint)bubbleDataPoint1))
            {
                Dictionary <XYDataPoint, double> dictionary;
                XYDataPoint index;
                (dictionary = dataPointRanks)[index = (XYDataPoint)bubbleDataPoint1] = dictionary[index] + 150.0;
            }
            else
            {
                dataPointRanks.Add((XYDataPoint)bubbleDataPoint1, 150.0);
            }
        }
Exemplo n.º 2
0
        internal double ProjectSizeToPixels(DataPoint dataPoint, double value)
        {
            BubbleDataPoint bubbleDataPoint = dataPoint as BubbleDataPoint;

            if (!this.BubbleSeries.IsSizeValueUsed || bubbleDataPoint == null || !bubbleDataPoint.IsSizeValueUsed)
            {
                return(dataPoint.MarkerSize);
            }
            if (!this.BubbleSeries.ActualSizeDataRange.HasData)
            {
                return(0.0);
            }
            Range <double> range = new Range <double>(ValueHelper.ToDouble((object)this.BubbleSeries.ActualSizeDataRange.Minimum), ValueHelper.ToDouble((object)this.BubbleSeries.ActualSizeDataRange.Maximum));
            double         num   = this.BubblePixelAreaSizeRange.Maximum;

            if (RangeHelper.Size(range) != 0.0)
            {
                value = Math.Min(Math.Max(value, range.Minimum), range.Maximum);
                num   = RangeHelper.Project(range, value, this.BubblePixelAreaSizeRange);
            }
            if (this.BubbleSeries.BubbleMarkerSizeRangeUnitType == BubbleSizeRangeUnitType.Relative)
            {
                num = 2.0 * Math.Sqrt(num / Math.PI);
            }
            return(num);
        }
Exemplo n.º 3
0
        internal override double GetMarkerSize(DataPoint dataPoint)
        {
            BubbleDataPoint bubbleDataPoint = dataPoint as BubbleDataPoint;

            if (bubbleDataPoint != null)
            {
                return(bubbleDataPoint.SizeValueInScaleUnits);
            }
            return(0.0);
        }
Exemplo n.º 4
0
        internal override void OnDataPointAdded(DataPoint dataPoint, bool useShowingAnimation)
        {
            BubbleDataPoint bubbleDataPoint = dataPoint as BubbleDataPoint;

            if (bubbleDataPoint != null)
            {
                bubbleDataPoint.SizeValueInScaleUnits = this.ProjectSizeToPixels(dataPoint, ValueHelper.ToDouble(bubbleDataPoint.SizeValue));
                bubbleDataPoint.SizeValueInScaleUnitsWithoutAnimation = bubbleDataPoint.SizeValueInScaleUnits;
            }
            base.OnDataPointAdded(dataPoint, useShowingAnimation);
        }
Exemplo n.º 5
0
        protected override void OnSeriesDataPointValueChanged(DataPoint dataPoint, string valueName, object oldValue, object newValue)
        {
            BubbleDataPoint bubbleDataPoint = dataPoint as BubbleDataPoint;

            switch (valueName)
            {
            case "MarkerSize":
                if (this.BubbleSeries.IsSizeValueUsed && bubbleDataPoint.IsSizeValueUsed)
                {
                    break;
                }
                this.ChangeDataPointSizeValue((BubbleDataPoint)dataPoint, newValue);
                break;

            case "SizeValue":
                if (!this.BubbleSeries.IsSizeValueUsed || !bubbleDataPoint.IsSizeValueUsed)
                {
                    break;
                }
                ((BubbleSeries)this.Series).UpdateSizeDataRange();
                this.ChangeDataPointSizeValue((BubbleDataPoint)dataPoint, newValue);
                break;

            case "SizeValueInScaleUnitsWithoutAnimation":
                if (this.ChartArea == null || !this.ChartArea.IsTemplateApplied)
                {
                    break;
                }
                this.ChartArea.UpdateSession.ExecuteOnceAfterUpdating((Action)(() => this.LabelVisibilityManager.UpdateDataPointLabelVisibility()), (object)"LabelVisibilityManager_UpdateDataPointLabelVisibility", (string)null);
                break;

            case "SizeValueInScaleUnits":
                if (this.ChartArea == null || !this.ChartArea.IsTemplateApplied)
                {
                    break;
                }
                Tuple <Series, string> tuple = new Tuple <Series, string>((Series)this.Series, "__UpdateDataPointVisibility__");
                if (this.ChartArea.UpdateSession.IsUpdating)
                {
                    this.ChartArea.UpdateSession.ExecuteOnceBeforeUpdating((Action)(() => this.UpdateDataPointVisibility()), (object)tuple);
                    break;
                }
                this.ChartArea.UpdateSession.PostExecuteOnceOnUIThread((Action)(() => this.UpdateDataPointVisibility()), (object)tuple);
                break;

            case "IsSizeValueUsed":
                this.OnSeriesModelPropertyChanged(valueName);
                break;

            default:
                base.OnSeriesDataPointValueChanged(dataPoint, valueName, oldValue, newValue);
                break;
            }
        }
Exemplo n.º 6
0
 private DataValueType GetSizeValueType()
 {
     if (this.SizeValueType == DataValueType.Auto)
     {
         BubbleDataPoint bubbleDataPoint = Enumerable.FirstOrDefault <BubbleDataPoint>(Enumerable.Where <BubbleDataPoint>(Enumerable.OfType <BubbleDataPoint>((IEnumerable)this.DataPoints), (Func <BubbleDataPoint, bool>)(item => item.SizeValue != null)));
         if (bubbleDataPoint != null)
         {
             return(ValueHelper.GetDataValueType(bubbleDataPoint.SizeValue));
         }
     }
     return(this.SizeValueType);
 }
Exemplo n.º 7
0
        internal override bool CanGraph(XYDataPoint dataPointXY)
        {
            BubbleDataPoint bubbleDataPoint = dataPointXY as BubbleDataPoint;

            if (bubbleDataPoint != null && this.BubbleSeries.IsSizeValueUsed && bubbleDataPoint.IsSizeValueUsed)
            {
                double doubleValue = 0.0;
                if (!ValueHelper.TryConvert(bubbleDataPoint.SizeValue, true, out doubleValue) || !ValueHelper.CanGraph(doubleValue) || DoubleHelper.LessOrEqualWithPrecision(bubbleDataPoint.SizeValueInScaleUnits, 0.0))
                {
                    return(false);
                }
            }
            return(base.CanGraph(dataPointXY));
        }
Exemplo n.º 8
0
        private void ChangeDataPointSizeValue(BubbleDataPoint dataPoint, object newValue)
        {
            if (dataPoint == null)
            {
                return;
            }
            double valueInScaleUnits = dataPoint.SizeValueInScaleUnits;
            double num = this.ProjectSizeToPixels((DataPoint)dataPoint, ValueHelper.ToDouble(newValue));

            dataPoint.SizeValueInScaleUnitsWithoutAnimation = num;
            if (valueInScaleUnits == num)
            {
                return;
            }
            if (ValueHelper.CanGraph(valueInScaleUnits) && ValueHelper.CanGraph(num) && (this.IsSeriesAnimationEnabled && this.ChartArea != null))
            {
                DependencyPropertyAnimationHelper.BeginAnimation(this.ChartArea, "SizeValueInScaleUnits", (object)valueInScaleUnits, (object)num, (Action <object, object>)((value1, value2) => dataPoint.SizeValueInScaleUnits = (double)value2), dataPoint.Storyboards, this.Series.ActualTransitionDuration, this.Series.ActualTransitionEasingFunction);
            }
            else
            {
                this.SkipToFillValueAnimation((XYDataPoint)dataPoint, "SizeValueInScaleUnits");
                dataPoint.SizeValueInScaleUnits = num;
            }
        }