Ejemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
#if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
#endif
            // Create the backing collection for Series
            var series = new UniqueObservableCollection <ISeries>();
            series.CollectionChanged += SeriesCollectionChanged;
            _series = series;

            // Create the backing collection for Axes
            var axes = new UniqueObservableCollection <IAxis>();
            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            InternalActualAxes            = actualAxes;
            ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection <object>();

            ChartAreaChildren = new AggregatedObservableCollection <UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged +=
                delegate { OnResourceDictionariesChanged(EventArgs.Empty); };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes a series from the plot area.
        /// </summary>
        /// <param name="series">The series to remove from the plot area.
        /// </param>
        private void RemoveSeriesFromPlotArea(ISeries series)
        {
            AggregatedObservableCollection <object> legendItemsList = LegendItems as AggregatedObservableCollection <object>;

            legendItemsList.ChildCollections.Remove(series.LegendItems);

            series.SeriesHost = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a series to the plot area and injects chart services.
        /// </summary>
        /// <param name="series">The series to add to the plot area.</param>
        private void AddSeriesToPlotArea(ISeries series)
        {
            series.SeriesHost = this;

            AggregatedObservableCollection <object> chartLegendItems = this.LegendItems as AggregatedObservableCollection <object>;
            int indexOfSeries = this.Series.IndexOf(series);

            chartLegendItems.ChildCollections.Insert(indexOfSeries, series.LegendItems);
        }
        /// <summary>
        /// Removes a series from the plot area.
        /// </summary>
        /// <param name="series">The series to remove from the plot area.
        /// </param>
        private void RemoveSeriesFromPlotArea(Series series)
        {
            AggregatedObservableCollection <UIElement> legendItemsList = LegendItems as AggregatedObservableCollection <UIElement>;

            legendItemsList.ChildCollections.Remove(series.LegendItems);

            ISeriesHost host = series as ISeriesHost;

            if (host != null)
            {
                host.GlobalSeriesIndexesInvalidated -= OnChildSeriesGlobalSeriesIndexesInvalidated;
            }
            series.SeriesHost = null;
        }
        /// <summary>
        /// Adds a series to the plot area and injects chart services.
        /// </summary>
        /// <param name="series">The series to add to the plot area.</param>
        private void AddSeriesToPlotArea(Series series)
        {
            series.SeriesHost = this;
            AggregatedObservableCollection <UIElement> chartLegendItems = this.LegendItems as AggregatedObservableCollection <UIElement>;

            int indexOfSeries = this.Series.IndexOf(series);

            chartLegendItems.ChildCollections.Insert(indexOfSeries, series.LegendItems);

            ISeriesHost host = series as ISeriesHost;

            if (host != null)
            {
                host.GlobalSeriesIndexesInvalidated += OnChildSeriesGlobalSeriesIndexesInvalidated;
            }
        }
        /// <summary>
        /// Initializes a new instance of the ISeriesHost class.
        /// </summary>
        public Chart()
        {
            DefaultStyleKey = typeof(Chart);

            // Create the backing collection for Series
            ObservableCollection <Series> series = new NoResetObservableCollection <Series>();

            series.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSeriesCollectionChanged);
            _series = series;
            _seriesCollectionSeriesContainerAdapter.Collection = series;

            // Create the backing collection for Axes
            ObservableCollection <IAxis> axes = new NoResetObservableCollection <IAxis>();

            axes.CollectionChanged += new NotifyCollectionChangedEventHandler(OnAxesCollectionChanged);
            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new ObservableCollection <IAxis>();

            actualAxes.CollectionChanged += new NotifyCollectionChangedEventHandler(ActualAxesCollectionChanged);
            this.InternalActualAxes       = actualAxes;
            this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            _gridLinesContainerChildrenChartAreaAdapter.Collection = _gridLinesContainerChildren;

            // Create collection for LegendItems
            AggregatedObservableCollection <UIElement> chartLegendItems = new AggregatedObservableCollection <UIElement>();

            _legendChildrenLegendAdapter.Collection = chartLegendItems;
            LegendItems = chartLegendItems;

            ISeriesHost host = this as ISeriesHost;

            host.GlobalSeriesIndexesInvalidated += OnGlobalSeriesIndexesInvalidated;

            // Create style dispenser
            StyleDispenser = new StyleDispenser();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
#if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
#endif
            // Create the backing collection for Series
            UniqueObservableCollection <Series> series = new UniqueObservableCollection <Series>();
            series.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection <IAxis> axes = new UniqueObservableCollection <IAxis>();
            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes       = actualAxes;
            this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            NoResetObservableCollection <UIElement> chartLegendItems = new AggregatedObservableCollection <UIElement>();
            _legendChildrenLegendAdapter.Collection = chartLegendItems;
            LegendItems = chartLegendItems;

            ISeriesHost host = this as ISeriesHost;
            host.GlobalSeriesIndexesInvalidated += OnGlobalSeriesIndexesInvalidated;

            ChartAreaChildren = new AggregatedObservableCollection <UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create style dispenser
            StyleDispenser = new StyleDispenser();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
            // Create the backing collection for Series
            UniqueObservableCollection <ISeries> series = new UniqueObservableCollection <ISeries>();

            series.CollectionChanged += new NotifyCollectionChangedEventHandler(SeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection <IAxis> axes = new UniqueObservableCollection <IAxis>();

            _axes = axes;

            ObservableCollection <IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);

            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes       = actualAxes;
            this.ActualAxes = new ReadOnlyCollection <IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection <object>();

            ChartAreaChildren = new AggregatedObservableCollection <UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate
            {
                OnResourceDictionariesChanged(EventArgs.Empty);
            };
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
            #if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
            #endif
            // Create the backing collection for Series
            UniqueObservableCollection<Series> series = new UniqueObservableCollection<Series>();
            series.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection<IAxis> axes = new UniqueObservableCollection<IAxis>();
            _axes = axes;

            ObservableCollection<IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes = actualAxes;
            this.ActualAxes = new ReadOnlyCollection<IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            NoResetObservableCollection<UIElement> chartLegendItems = new AggregatedObservableCollection<UIElement>();
            _legendChildrenLegendAdapter.Collection = chartLegendItems;
            LegendItems = chartLegendItems;

            ISeriesHost host = this as ISeriesHost;
            host.GlobalSeriesIndexesInvalidated += OnGlobalSeriesIndexesInvalidated;

            ChartAreaChildren = new AggregatedObservableCollection<UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create style dispenser
            StyleDispenser = new StyleDispenser();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the Chart class.
        /// </summary>
        public Chart()
        {
#if SILVERLIGHT
            DefaultStyleKey = typeof(Chart);
#endif
            // Create the backing collection for Series
            UniqueObservableCollection<ISeries> series = new UniqueObservableCollection<ISeries>();
            series.CollectionChanged += new NotifyCollectionChangedEventHandler(SeriesCollectionChanged);
            _series = series;

            // Create the backing collection for Axes
            UniqueObservableCollection<IAxis> axes = new UniqueObservableCollection<IAxis>();
            _axes = axes;

            ObservableCollection<IAxis> actualAxes = new SeriesHostAxesCollection(this, axes);
            actualAxes.CollectionChanged += ActualAxesCollectionChanged;
            this.InternalActualAxes = actualAxes;
            this.ActualAxes = new ReadOnlyCollection<IAxis>(InternalActualAxes);

            // Create collection for LegendItems
            LegendItems = new AggregatedObservableCollection<object>();

            ChartAreaChildren = new AggregatedObservableCollection<UIElement>();
            ChartAreaChildren.ChildCollections.Add(_edgeAxes);
            ChartAreaChildren.ChildCollections.Add(_backgroundElements);
            ChartAreaChildren.ChildCollections.Add(Series);
            ChartAreaChildren.ChildCollections.Add(_foregroundElements);

            _chartAreaChildrenListAdapter.Collection = ChartAreaChildren;

            // Create a dispenser
            ResourceDictionaryDispenser = new ResourceDictionaryDispenser();
            ResourceDictionaryDispenser.ResourceDictionariesChanged += delegate
            {
                OnResourceDictionariesChanged(EventArgs.Empty);
            };
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the ISeriesHost class.
        /// </summary>
        public Chart()
        {
            DefaultStyleKey = typeof(Chart);

            // Create the backing collection for Series
            ObservableCollection<Series> series = new NoResetObservableCollection<Series>();
            series.CollectionChanged += new NotifyCollectionChangedEventHandler(OnSeriesCollectionChanged);
            _series = series;
            _seriesCollectionSeriesContainerAdapter.Collection = series;

            // Create the backing collection for Axes
            ObservableCollection<IAxis> axes = new NoResetObservableCollection<IAxis>();
            axes.CollectionChanged += new NotifyCollectionChangedEventHandler(OnAxesCollectionChanged);
            _axes = axes;

            ObservableCollection<IAxis> actualAxes = new ObservableCollection<IAxis>();
            actualAxes.CollectionChanged += new NotifyCollectionChangedEventHandler(ActualAxesCollectionChanged);
            this.InternalActualAxes = actualAxes;
            this.ActualAxes = new ReadOnlyCollection<IAxis>(InternalActualAxes);

            _gridLinesContainerChildrenChartAreaAdapter.Collection = _gridLinesContainerChildren;

            // Create collection for LegendItems
            AggregatedObservableCollection<UIElement> chartLegendItems = new AggregatedObservableCollection<UIElement>();
            _legendChildrenLegendAdapter.Collection = chartLegendItems;
            LegendItems = chartLegendItems;

            ISeriesHost host = this as ISeriesHost;
            host.GlobalSeriesIndexesInvalidated += OnGlobalSeriesIndexesInvalidated;

            // Create style dispenser
            StyleDispenser = new StyleDispenser();
        }