Пример #1
0
        private void OnRaiseChartCollectionChanged(ChartCollectionChangedEventArgs <T> e)
        {
            var handler = this.ChartCollectionChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #2
0
        private void Series_ChartCollectionChanged(object sender, ChartCollectionChangedEventArgs <ISeries> e)
        {
            bool update     = false;
            bool isFullDraw = false;

            switch (e.Action)
            {
            case ChartCollectionChangedAction.Add:
                if (e.NewItems != null && e.NewItems.Count > 0)
                {
                    foreach (var series in e.NewItems)
                    {
                        if (series == null)
                        {
                            continue;
                        }

                        series.PropertyChanged         += Series_PropertyChanged;
                        series.ValuesCollectionChanged += Series_ValuesCollectionChanged;
                        update = true;
                    }
                }
                break;

            case ChartCollectionChangedAction.Move:
                break;

            case ChartCollectionChangedAction.Remove:
                if (e.OldItems != null)
                {
                    foreach (var series in e.OldItems)
                    {
                        if (series == null)
                        {
                            continue;
                        }

                        series.PropertyChanged         -= Series_PropertyChanged;
                        series.ValuesCollectionChanged -= Series_ValuesCollectionChanged;
                        isFullDraw = series.Clear();
                    }
                }
                break;

            case ChartCollectionChangedAction.Replace:
                if (e.NewItems != null)
                {
                    foreach (var series in e.NewItems)
                    {
                        if (series == null)
                        {
                            continue;
                        }

                        series.PropertyChanged         += Series_PropertyChanged;
                        series.ValuesCollectionChanged += Series_ValuesCollectionChanged;
                        update = true;
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (var series in e.OldItems)
                    {
                        if (series == null)
                        {
                            continue;
                        }

                        series.PropertyChanged         -= Series_PropertyChanged;
                        series.ValuesCollectionChanged -= Series_ValuesCollectionChanged;
                        isFullDraw = series.Clear();
                    }
                }
                break;

            default:
                throw new NotImplementedException(e.Action.ToString());
            }

            if (isFullDraw)
            {
                this.UpdateAll();
            }
            else if (update)
            {
                this.DrawSeries(this._chartGrid, this._chartCanvas, e.NewItems, null, null);
            }
        }
Пример #3
0
        private void AxisCollection_ChartCollectionChanged(object sender, ChartCollectionChangedEventArgs <AxisAbs> e)
        {
            bool update = false;

            switch (e.Action)
            {
            case ChartCollectionChangedAction.Add:
                if (e.NewItems != null && e.NewItems.Count > 0)
                {
                    foreach (var axis in e.NewItems)
                    {
                        if (axis == null)
                        {
                            continue;
                        }

                        axis.PropertyChanged += Axis_PropertyChanged;
                        update = true;
                    }
                }
                break;

            case ChartCollectionChangedAction.Move:
                break;

            case ChartCollectionChangedAction.Remove:
                if (e.OldItems != null && e.OldItems.Count > 0)
                {
                    foreach (var axis in e.OldItems)
                    {
                        if (axis == null)
                        {
                            continue;
                        }

                        axis.PropertyChanged -= Axis_PropertyChanged;
                        update = true;
                    }
                }
                break;

            case ChartCollectionChangedAction.Replace:
                if (e.NewItems != null && e.NewItems.Count > 0)
                {
                    foreach (var axis in e.NewItems)
                    {
                        if (axis == null)
                        {
                            continue;
                        }

                        axis.PropertyChanged += Axis_PropertyChanged;
                        update = true;
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (var axis in e.OldItems)
                    {
                        if (axis == null)
                        {
                            continue;
                        }

                        axis.PropertyChanged -= Axis_PropertyChanged;
                        update = true;
                    }
                }
                break;

            default:
                throw new NotImplementedException(e.Action.ToString());
            }

            if (update)
            {
                this.UpdateAll();
            }
        }