Beispiel #1
0
        internal virtual void OnXScaleChanged()
        {
            DateTime now = DateTime.Now;

            if (this.ChartArea == null)
            {
                return;
            }
            this.ChartArea.UpdateSession.BeginUpdates();
            bool flag = true;

            foreach (XYDataPoint xyDataPoint in (Collection <DataPoint>) this.Series.DataPoints)
            {
                xyDataPoint.XValueInScaleUnitsWithoutAnimation = this.Series.XAxis.Scale.ProjectDataValue(xyDataPoint.XValue);
                string         storyboardKey = DependencyPropertyAnimationHelper.GetStoryboardKey("XValueInScaleUnits");
                StoryboardInfo si            = (StoryboardInfo)null;
                if (xyDataPoint.Storyboards.TryGetValue(storyboardKey, out si) && si.Storyboard.Children.Count > 0)
                {
                    DoubleAnimation doubleAnimation = si.Storyboard.Children[0] as DoubleAnimation;
                    if (doubleAnimation != null && xyDataPoint.XValue != null)
                    {
                        double?to = doubleAnimation.To;
                        double xvalueInScaleUnits = xyDataPoint.XValueInScaleUnits;
                        if ((to.GetValueOrDefault() != xvalueInScaleUnits ? 1 : (!to.HasValue ? 1 : 0)) != 0)
                        {
                            if (!this.IsAnimationDirectionChanged(si, doubleAnimation.To.Value, xyDataPoint.XValueInScaleUnitsWithoutAnimation))
                            {
                                flag = false;
                            }
                            doubleAnimation.To = new double?(xyDataPoint.XValueInScaleUnitsWithoutAnimation);
                            continue;
                        }
                    }
                }
                xyDataPoint.XValueInScaleUnits = xyDataPoint.XValueInScaleUnitsWithoutAnimation;
            }
            if (!flag)
            {
                foreach (XYDataPoint dataPoint in (Collection <DataPoint>) this.Series.DataPoints)
                {
                    this.SkipToFillValueAnimation(dataPoint, "XValueInScaleUnits");
                }
            }
            if (this.Series.LabelVisibility == Visibility.Visible)
            {
                LabelVisibilityManager manager = this.LabelVisibilityManager;
                manager.InvalidateXIntervals();
                this.ChartArea.UpdateSession.ExecuteOnceAfterUpdating((Action)(() => manager.UpdateDataPointLabelVisibility()), (object)"LabelVisibilityManager_UpdateDataPointLabelVisibility", (string)null);
            }
            this.ChartArea.UpdateSession.EndUpdates();
        }