コード例 #1
0
        internal override bool CheckSimplifiedRenderingMode()
        {
            bool flag = base.CheckSimplifiedRenderingMode();

            if (flag)
            {
                EnumerableFunctions.ForEach <DataPoint>(this.VisibleDataPoints, (Action <DataPoint>)(item => this.UpdateView(item)));
            }
            return(flag);
        }
コード例 #2
0
 protected virtual void OnVisibilityListenerPropertyChanged(object oldValue, object newValue)
 {
     if ((Visibility)newValue == Visibility.Collapsed)
     {
         EnumerableFunctions.ForEach <UIElement>(Enumerable.OfType <UIElement>((IEnumerable)Enumerable.Select <AxisPresenter.AxisPanelType, Panel>((IEnumerable <AxisPresenter.AxisPanelType>) this.PanelsDictionary.Keys, (Func <AxisPresenter.AxisPanelType, Panel>)(panelType => this.GetAxisPanel(panelType)))), (Action <UIElement>)(item => item.Visibility = Visibility.Collapsed));
     }
     else
     {
         EnumerableFunctions.ForEach <UIElement>(Enumerable.OfType <UIElement>((IEnumerable)Enumerable.Select <AxisPresenter.AxisPanelType, Panel>((IEnumerable <AxisPresenter.AxisPanelType>) this.PanelsDictionary.Keys, (Func <AxisPresenter.AxisPanelType, Panel>)(panelType => this.GetAxisPanel(panelType)))), (Action <UIElement>)(item => item.ClearValue(UIElement.VisibilityProperty)));
     }
 }
コード例 #3
0
        internal virtual Dictionary <object, List <Series> > GroupSeriesByClusters(IList <XYSeries> clusterSeries)
        {
            Dictionary <object, List <Series> > clusterGroups = new Dictionary <object, List <Series> >();

            foreach (ColumnSeries columnSeries1 in (IEnumerable <XYSeries>)clusterSeries)
            {
                List <Series> list = new List <Series>();
                if (columnSeries1.ClusterGroupKey == null)
                {
                    list.Add((Series)columnSeries1);
                    clusterGroups.Add((object)new Tuple <ColumnSeries>(columnSeries1), list);
                }
                else if (!clusterGroups.ContainsKey(columnSeries1.ClusterGroupKey))
                {
                    foreach (ColumnSeries columnSeries2 in (IEnumerable <XYSeries>)clusterSeries)
                    {
                        if (ValueHelper.AreEqual(columnSeries2.ClusterGroupKey, columnSeries1.ClusterGroupKey))
                        {
                            list.Add((Series)columnSeries2);
                        }
                    }
                    clusterGroups.Add(columnSeries1.ClusterGroupKey, list);
                }
            }
            IList <StackedColumnSeries> list1 = (IList <StackedColumnSeries>)Enumerable.ToList <StackedColumnSeries>(Enumerable.OfType <StackedColumnSeries>((IEnumerable)Enumerable.Where <XYSeries>((IEnumerable <XYSeries>) this.XYChartArea.Series, (Func <XYSeries, bool>)(s => s.Visibility == Visibility.Visible))));

            foreach (List <Series> list2 in clusterGroups.Values)
            {
                List <Series> groupSeries = list2;
                EnumerableFunctions.ForEach <Series>(Enumerable.Where <Series>((IEnumerable <Series>)groupSeries.ToArray(), (Func <Series, bool>)(s => s is StackedColumnSeries)), (Action <Series>)(s => groupSeries.Remove(s)));
            }
            EnumerableFunctions.ForEach <KeyValuePair <object, List <Series> > >(Enumerable.Where <KeyValuePair <object, List <Series> > >((IEnumerable <KeyValuePair <object, List <Series> > >)Enumerable.ToArray <KeyValuePair <object, List <Series> > >((IEnumerable <KeyValuePair <object, List <Series> > >)clusterGroups), (Func <KeyValuePair <object, List <Series> >, bool>)(item => item.Value.Count == 0)), (Action <KeyValuePair <object, List <Series> > >)(item => clusterGroups.Remove(item.Key)));
            foreach (StackedColumnSeries series1 in (IEnumerable <StackedColumnSeries>)list1)
            {
                List <Series> list2 = new List <Series>();
                Tuple <DataValueType, DataValueType, bool, object> seriesKey = StackedColumnSeriesPresenter.GetSeriesKey(series1);
                if (!clusterGroups.ContainsKey((object)seriesKey) && seriesKey.Item1 != DataValueType.Auto)
                {
                    foreach (StackedColumnSeries series2 in (IEnumerable <StackedColumnSeries>)list1)
                    {
                        if (StackedColumnSeriesPresenter.GetSeriesKey(series2).Equals((object)seriesKey))
                        {
                            list2.Add((Series)series2);
                        }
                    }
                    clusterGroups.Add((object)seriesKey, list2);
                }
            }
            return(clusterGroups);
        }
コード例 #4
0
        internal void UpdateIsAnySeriesHaveSelectionFlag()
        {
            if (this.SuspendSelectionChangedEventsCount != 0)
            {
                return;
            }
            bool seriesHaveSelection = this.IsAnySeriesHaveSelection;

            this.IsAnySeriesHaveSelection = Enumerable.FirstOrDefault <Series>(this.GetSeries(), (Func <Series, bool>)(s => s.HaveSelectedDataPoints)) != null;
            if (seriesHaveSelection == this.IsAnySeriesHaveSelection)
            {
                return;
            }
            EnumerableFunctions.ForEach <Series>(this.GetSeries(), (Action <Series>)(s => s.UpdateSeriesSelectionStateFromChart()));
        }
コード例 #5
0
ファイル: Series.cs プロジェクト: sulerzh/chart
 public void ClearSelectedDataPoints()
 {
     if (!this.HaveSelectedDataPoints)
         return;
     DataPointSelectionChangedEventArgs e = new DataPointSelectionChangedEventArgs((IList<DataPoint>)Enumerable.ToList<DataPoint>(Enumerable.Where<DataPoint>((IEnumerable<DataPoint>)this.DataPoints, (Func<DataPoint, bool>)(p => p.IsSelected))), (IList<DataPoint>)null);
     if (e.RemovedItems.Count <= 0)
         return;
     try
     {
         this._clearSelectedDataPointsPerformingFlag = true;
         EnumerableFunctions.ForEach<DataPoint>((IEnumerable<DataPoint>)e.RemovedItems, (Action<DataPoint>)(p => p.IsSelected = false));
         this.ChartArea.FireDataPointSelectionChanged(e);
     }
     finally
     {
         this._clearSelectedDataPointsPerformingFlag = false;
     }
 }
コード例 #6
0
ファイル: SeriesPresenter.cs プロジェクト: sulerzh/chart
 public virtual void OnSeriesAdded()
 {
     this.SeriesCollectionChanging = true;
     this.ChartArea.ActivateChildModel((FrameworkElement)this.Series);
     if (this.ChartArea.IsTemplateApplied)
     {
         this.ChartArea.UpdateSession.BeginUpdates();
         this.Series.SyncDataPoints();
         this.UpdateRelatedSeriesPresenters();
         this.Series.UpdateSelectedDataPointFlag((DataPoint)null);
         this.ChartArea.UpdateSession.ExecuteOnceBeforeUpdating((Action)(() => this.UpdateDataPointVisibility()), (object)new Tuple <Series, string>(this.Series, "__UpdateDataPointVisibility__"));
         this.ChartArea.UpdateSession.Update((IUpdatable)this.Series);
         bool enableAnimation = this.ChartArea.IsShowingAnimationEnabled;
         EnumerableFunctions.ForEach <DataPoint>((IEnumerable <DataPoint>) this.Series.DataPoints, (Action <DataPoint>)(item => this.OnDataPointAdded(item, enableAnimation)));
         this.ChartArea.UpdateSession.EndUpdates();
     }
     this.SeriesCollectionChanging = false;
 }
コード例 #7
0
ファイル: XYSeries.cs プロジェクト: sulerzh/chart
        internal override void RemoveAllDataPoints()
        {
            IEnumerable <DataPoint> that = (IEnumerable <DataPoint>) this._dataPointsCollectionShadow;

            this._dataPointsByXValue = (OrderedMultipleDictionary <object, DataPoint>)null;
            if (that == null)
            {
                return;
            }
            if (this.ChartArea != null && this.ChartArea.IsTemplateApplied)
            {
                EnumerableFunctions.ForEach <DataPoint>(that, (Action <DataPoint>)(item => item.ViewState = DataPointViewState.Hiding));
            }
            else
            {
                EnumerableFunctions.ForEach <DataPoint>(that, (Action <DataPoint>)(item => this.UninitializeDataPoint(item)));
            }
        }
コード例 #8
0
        protected override void OnSeriesDataPointValueChanged(DataPoint dataPoint, string valueName, object oldValue, object newValue)
        {
            object obj  = (object)null;
            bool   flag = false;

            switch (valueName)
            {
            case "XValue":
                obj  = ValueHelper.ConvertValue(oldValue, this.Series.ActualXValueType);
                flag = true;
                break;

            case "YValue":
                obj = ValueHelper.ConvertValue(((XYDataPoint)dataPoint).XValue, this.Series.ActualXValueType);
                break;

            case "YValueInScaleUnits":
                if (this.ChartArea != null && this.ChartArea.IsTemplateApplied)
                {
                    obj = ValueHelper.ConvertValue(((XYDataPoint)dataPoint).XValue, this.Series.ActualXValueType);
                    if (!this._suppressCounterpartInvalidationFlag)
                    {
                        EnumerableFunctions.ForEach <XYDataPoint>(Enumerable.Where <XYDataPoint>((IEnumerable <XYDataPoint>) this.GetCounterpartDataPoints(obj, true), (Func <XYDataPoint, bool>)(p => p != dataPoint)), (Action <XYDataPoint>)(p => p.Update()));
                        break;
                    }
                    break;
                }
                break;
            }
            if (obj != null && this.ChartArea != null)
            {
                this.DataPointsByXValueRanges.Remove(obj);
            }
            if (flag && this.ChartArea != null && (!this.ChartArea.IsDirty && !this.ChartArea.UpdateSession.IsUpdating))
            {
                this.ChartArea.Invalidate();
            }
            base.OnSeriesDataPointValueChanged(dataPoint, valueName, oldValue, newValue);
        }
コード例 #9
0
        protected internal void EnsureAxisMargins()
        {
            if (!this.IsDirty)
            {
                return;
            }
            this.SeriesMarginInfos.Clear();
            AxisMargin marginResult = AxisMargin.Empty;

            if (this.Axis.Scale != null && this.Axis.Orientation == AxisOrientation.X)
            {
                EnumerableFunctions.ForEach <KeyValuePair <int, AxisMargin> >(Enumerable.Select <IGrouping <int, Series>, KeyValuePair <int, AxisMargin> >(Enumerable.GroupBy <Series, int>(this.ChartArea.FindSeries(this.Axis), (Func <Series, int>)(series => series.ClusterKey)), (Func <IGrouping <int, Series>, KeyValuePair <int, AxisMargin> >)(seriesGroup => new KeyValuePair <int, AxisMargin>(seriesGroup.Key, ((XYSeriesPresenter)Enumerable.FirstOrDefault <Series>((IEnumerable <Series>)seriesGroup).SeriesPresenter).GetSeriesMarginInfo(this.Axis.IsMarginVisible)))), (Action <KeyValuePair <int, AxisMargin> >)(info => this.SeriesMarginInfos.Add(info.Key, info.Value)));
                if (!(this.Axis.Scale is CategoryScale))
                {
                    EnumerableFunctions.ForEach <KeyValuePair <int, AxisMargin> >((IEnumerable <KeyValuePair <int, AxisMargin> >) this.SeriesMarginInfos, (Action <KeyValuePair <int, AxisMargin> >)(info => marginResult = marginResult.Extend(info.Value)));
                    AxisMargin axisMargin = new AxisMargin(this.Axis.Scale.ProjectedStartMargin, this.Axis.Scale.ProjectedEndMargin);
                    marginResult = new AxisMargin(Math.Max(0.0, marginResult.Start - axisMargin.Start), Math.Max(0.0, marginResult.End - axisMargin.End));
                }
            }
            this.AggregatedSeriesMargins = new AxisMargin(marginResult.Start * (1.0 - marginResult.Start), marginResult.End * (1.0 - marginResult.End));
            this.IsDirty = false;
        }
コード例 #10
0
ファイル: XYSeries.cs プロジェクト: sulerzh/chart
 internal override void OnDataPointsCollectionChanged(IEnumerable <DataPoint> removedDataPoints, IEnumerable <DataPoint> addedDataPoints, bool isResetting)
 {
     if (removedDataPoints != null)
     {
         if (this.DataPoints.Count == 0)
         {
             this.DataPointsByXValue.Clear();
         }
         else
         {
             foreach (DataPoint dataPoint in removedDataPoints)
             {
                 this.DataPointsByXValue.Remove(dataPoint);
             }
         }
     }
     if (isResetting)
     {
         removedDataPoints        = (IEnumerable <DataPoint>) this._dataPointsCollectionShadow;
         this._dataPointsByXValue = (OrderedMultipleDictionary <object, DataPoint>)null;
         this.ResetActualValueType();
         this.InvalidateDataPointsByXValue();
         addedDataPoints = (IEnumerable <DataPoint>) this.DataPoints;
     }
     if (addedDataPoints != null && Enumerable.Any <DataPoint>(addedDataPoints))
     {
         foreach (DataPoint dataPoint in addedDataPoints)
         {
             this.InitializeDataPoint(dataPoint);
         }
         DataValueType actualXvalueType = this.ActualXValueType;
         this.UpdateActualXValueType(addedDataPoints);
         if (this.ActualXValueType == actualXvalueType)
         {
             this.AddDataPointsByXValue(addedDataPoints);
         }
         this.UpdateActualYValueType(addedDataPoints);
     }
     this.UpdateActualDataPoints();
     this.UpdateActualDataRange();
     if (this.ChartArea != null && this.ChartArea.IsTemplateApplied)
     {
         if (!this.SeriesPresenter.SeriesCollectionChanging)
         {
             this.ChartArea.UpdateSession.BeginUpdates();
             bool useAnimation = this.ChartArea.IsShowingAnimationEnabled && (this.XAxis.Scale == null || !this.XAxis.Scale.IsScrolling) && (this.YAxis.Scale == null || !this.YAxis.Scale.IsScrolling);
             if (removedDataPoints != null)
             {
                 EnumerableFunctions.ForEach <DataPoint>(removedDataPoints, (Action <DataPoint>)(item => this.SeriesPresenter.OnDataPointRemoved(item, useAnimation)));
             }
             if (addedDataPoints != null)
             {
                 EnumerableFunctions.ForEach <DataPoint>(addedDataPoints, (Action <DataPoint>)(item => this.SeriesPresenter.OnDataPointAdded(item, useAnimation)));
             }
             this.ChartArea.UpdateSession.EndUpdates();
         }
     }
     else if (removedDataPoints != null)
     {
         EnumerableFunctions.ForEach <DataPoint>(removedDataPoints, (Action <DataPoint>)(item => this.UninitializeDataPoint(item)));
     }
     this._dataPointsCollectionShadow = Enumerable.ToArray <DataPoint>((IEnumerable <DataPoint>) this.DataPoints);
 }
コード例 #11
0
 protected virtual void UpdateView()
 {
     EnumerableFunctions.ForEach <IUpdatable>(Enumerable.OfType <IUpdatable>((IEnumerable)Enumerable.Select <AxisPresenter.AxisPanelType, Panel>((IEnumerable <AxisPresenter.AxisPanelType>) this.PanelsDictionary.Keys, (Func <AxisPresenter.AxisPanelType, Panel>)(panelType => this.GetAxisPanel(panelType)))), (Action <IUpdatable>)(item => item.Update()));
 }