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
            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.º 2
0
 /// <summary>
 /// Initializes a new instance of a StyleEnumerator.
 /// </summary>
 /// <param name="dispenser">The style dispenser that dispensed this
 /// StyleEnumerator.</param>
 /// <param name="stylePredicate">A predicate used to determine which
 /// styles to return.</param>
 public StyleEnumerator(StyleDispenser dispenser, Func <Style, bool> stylePredicate)
 {
     this.StyleDispenser = dispenser;
     this.StylePredicate = stylePredicate;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Raises the style dispensed event.
 /// </summary>
 /// <param name="args">Information about the style dispensed.</param>
 protected virtual void OnStyleDispensed(StyleDispensedEventArgs args)
 {
     StyleDispenser.EnumeratorStyleDispensed(this, args);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Resets the styles dispensed by the chart.
 /// </summary>
 public void ResetStyles()
 {
     StyleDispenser.ResetStyles();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Returns a rotating enumerator of Style objects that coordinates with
 /// the style dispenser object to ensure that no two enumerators are
 /// currently on the same style if possible.  If the style
 /// dispenser is reset or its collection of styles is changed then
 /// the enumerators will also be reset.
 /// </summary>
 /// <param name="stylePredicate">A predicate that returns a value
 /// indicating whether to return a style.</param>
 /// <returns>An enumerator of styles.</returns>
 public IEnumerator <Style> GetStylesWhere(Func <Style, bool> stylePredicate)
 {
     return(StyleDispenser.GetStylesWhere(stylePredicate));
 }