Exemplo n.º 1
0
        private void ChangeDataPointYValue(XYDataPoint dataPoint, object newValue)
        {
            if (dataPoint == null)
            {
                return;
            }
            double yvalueInScaleUnits = dataPoint.YValueInScaleUnits;
            double d = this.Series.YAxis.Scale == null ? double.NaN : this.Series.YAxis.Scale.ProjectDataValue(newValue);

            dataPoint.YValueInScaleUnitsWithoutAnimation = d;
            if (!double.IsNaN(d) && !double.IsNaN(yvalueInScaleUnits) && (this.IsSeriesAnimationEnabled && this.ChartArea != null))
            {
                DependencyPropertyAnimationHelper.BeginAnimation(this.ChartArea, "YValueInScaleUnits", (object)yvalueInScaleUnits, (object)d, (Action <object, object>)((value1, value2) =>
                {
                    if (double.IsNaN(dataPoint.YValueInScaleUnitsWithoutAnimation))
                    {
                        return;
                    }
                    dataPoint.YValueInScaleUnits = (double)value2;
                }), dataPoint.Storyboards, this.Series.ActualTransitionDuration, this.Series.ActualTransitionEasingFunction);
            }
            else
            {
                this.SkipToFillValueAnimation(dataPoint, "YValueInScaleUnits");
                dataPoint.YValueInScaleUnits = d;
            }
        }
        public static void SetValueWithAnimation(this DataPoint dataPoint, DependencyProperty dp, string propertyName, double value)
        {
            double num = (double)dataPoint.GetValue(dp);

            if (num == value)
            {
                return;
            }
            Series series = dataPoint.Series;

            if (series == null || series.ChartArea == null || (DoubleHelper.IsNaN(num) || DoubleHelper.IsNaN(value)))
            {
                dataPoint.SetValue(dp, (object)value);
            }
            else
            {
                DependencyPropertyAnimationHelper.BeginAnimation(series.ChartArea, propertyName, (object)num, (object)value, (Action <object, object>)((current, next) => dataPoint.SetValue(dp, next)), dataPoint.Storyboards, series.ActualTransitionDuration, series.ActualTransitionEasingFunction);
            }
        }
Exemplo n.º 3
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;
            }
        }