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(); }
internal override void AdjustDataPointLabelVisibilityRating(LabelVisibilityManager.DataPointRange range, Dictionary<XYDataPoint, double> dataPointRanks) { if (range.DataPoints.Count <= 0) return; XYDataPoint xyDataPoint = range.DataPoints[0] as XYDataPoint; foreach (XYDataPoint key in range.DataPoints) { if (ValueHelper.Compare(key.XValue as IComparable, xyDataPoint.XValue as IComparable) == 0) { if (dataPointRanks.ContainsKey(key)) dataPointRanks[key] = 100.0; else dataPointRanks.Add(key, 100.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); }
private void RecalculateXIntervals() { if (this._chartArea == null || this._chartArea.Series.Count <= 0) { return; } if (double.IsNaN(this.XScaleLabelDensity)) { XYSeries xySeries = Enumerable.FirstOrDefault <XYSeries>((IEnumerable <XYSeries>) this._chartArea.Series); if (xySeries != null) { Scale scale = xySeries.XAxis.Scale; if (scale != null) { this._xScalePositions = LabelVisibilityManager.GetScalePositions(scale); } } } else { this._xScalePositions = LabelVisibilityManager.IterateDoubles(0.0, 1.0, 1.0 / this.XScaleLabelDensity); } this._dataPointRanges.Clear(); }
internal virtual void AdjustDataPointLabelVisibilityRating(LabelVisibilityManager.DataPointRange range, Dictionary<XYDataPoint, double> dataPointRanks) { }
private Dictionary<XYDataPoint, double> GetDefaultRanking(LabelVisibilityManager.DataPointRange range, LabelVisibilityManager.DataPointRange prevRange, ref bool useMaximum) { Dictionary<XYDataPoint, double> dictionary = new Dictionary<XYDataPoint, double>(); if (!range.ProjectedYRange.HasData) { double num1 = 0.05; if (prevRange != null && prevRange.DataPointProjectedYRange.HasData && range.DataPointProjectedYRange.HasData) { if (range.DataPointProjectedYRange.Maximum - prevRange.DataPointProjectedYRange.Maximum > num1 && range.DataPointProjectedYRange.Minimum - prevRange.DataPointProjectedYRange.Minimum > num1) useMaximum = true; else if (prevRange.DataPointProjectedYRange.Maximum - range.DataPointProjectedYRange.Maximum > num1 && prevRange.DataPointProjectedYRange.Minimum - range.DataPointProjectedYRange.Minimum > num1) useMaximum = false; else if (range.DataPointProjectedYRange.Maximum - prevRange.DataPointProjectedYRange.Maximum > num1 && prevRange.DataPointProjectedYRange.Minimum - range.DataPointProjectedYRange.Minimum > num1) { double num2 = Math.Abs(range.DataPointProjectedYRange.Maximum - prevRange.DataPointProjectedYRange.Maximum); double num3 = Math.Abs(range.DataPointProjectedYRange.Minimum - prevRange.DataPointProjectedYRange.Minimum); useMaximum = num2 > num3; } else useMaximum = !useMaximum; } } XYDataPoint key = (XYDataPoint)null; double d = double.NaN; foreach (XYDataPoint xyDataPoint in range.DataPoints) { if (double.IsNaN(d)) { key = xyDataPoint; d = xyDataPoint.YValueInScaleUnitsWithoutAnimation; } else if (useMaximum && d < xyDataPoint.YValueInScaleUnitsWithoutAnimation) { key = xyDataPoint; d = xyDataPoint.YValueInScaleUnitsWithoutAnimation; } else if (!useMaximum && d >= xyDataPoint.YValueInScaleUnitsWithoutAnimation) { key = xyDataPoint; d = xyDataPoint.YValueInScaleUnitsWithoutAnimation; } } if (key != null) dictionary.Add(key, 50.0); if (range.ProjectedYRange.HasData) useMaximum = !useMaximum; return dictionary; }