/// <summary>
        /// Themes the changed.
        /// </summary>
        /// <param name="args">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        internal void ThemeChanged(DependencyPropertyChangedEventArgs args)
        {
            switch (Theme)
            {
            case Theme.Arctic:
                _brushes = Themes.ArcticBrushes();
                break;

            case Theme.Autmn:
                _brushes = Themes.AutmnBrushes();
                break;

            case Theme.Cold:
                _brushes = Themes.ColdBrushes();
                break;

            case Theme.Flower:
                _brushes = Themes.FlowerBrushes();
                break;

            case Theme.Forest:
                _brushes = Themes.ForestBrushes();
                break;

            case Theme.Grayscale:
                _brushes = Themes.GrayscaleBrushes();
                break;

            case Theme.Ground:
                _brushes = Themes.GroundBrushes();
                break;

            case Theme.Lialac:
                _brushes = Themes.LialacBrushes();
                break;

            case Theme.Natural:
                _brushes = Themes.NaturalBrushes();
                break;

            case Theme.Pastel:
                _brushes = Themes.PastelBrushes();
                break;

            case Theme.Rainbow:
                _brushes = Themes.RainbowBrushes();
                break;

            case Theme.Spring:
                _brushes = Themes.SpringBrushes();
                break;

            case Theme.Summer:
                _brushes = Themes.SummerBrushes();
                break;

            case Theme.Warm:
                _brushes = Themes.WarmBrushes();
                break;

            case Theme.Metro:
                _brushes = Themes.MetroBrushes();
                break;

            case Theme.Custom:
                break;

            default:
                break;
            }
            BrushTheme();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SparrowChart"/> class.
        /// </summary>
        public SparrowChart()
        {
            this.DefaultStyleKey          = typeof(SparrowChart);
            this.Series                   = new SeriesCollection();
            this.XAxes                    = new Axes();
            this.XAxes.CollectionChanged += OnAxesCollectionChanged;
            this.YAxes                    = new Axes();
            this.YAxes.CollectionChanged += OnAxesCollectionChanged;
            _brushes             = Themes.MetroBrushes();
            LegendItems          = new ObservableCollection <LegendItem>();
            ActualCategoryValues = new List <string>();
            ColumnSeries         = new List <ColumnSeries>();
            HiLoOpenCloseSeries  = new List <HiLoOpenCloseSeries>();
            CandleStickSeries    = new List <ColumnSeries>();
            styles = new ResourceDictionary()
            {
#if X86
                Source = new Uri(@"/Sparrow.Chart.DirectX2D_x86;component/Themes/Styles.xaml", UriKind.Relative)
#elif X64
                Source = new Uri(@"/Sparrow.Chart.DirectX2D_x64;component/Themes/Styles.xaml", UriKind.Relative)
#else
#if WPF
#if NET45
                Source = new Uri(@"/Sparrow.Chart.Wpf.45;component/Themes/Styles.xaml", UriKind.Relative)
#elif NET40
                Source = new Uri(@"/Sparrow.Chart.Wpf.40;component/Themes/Styles.xaml", UriKind.Relative)
#else
                Source = new Uri(@"/Sparrow.Chart.Wpf.35;component/Themes/Styles.xaml", UriKind.Relative)
#endif
#elif SILVERLIGHT
#if SL5
                Source = new Uri(@"/Sparrow.Chart.Silverlight.50;component/Themes/Styles.xaml", UriKind.Relative)
#else
                Source = new Uri(@"/Sparrow.Chart.Silverlight.40;component/Themes/Styles.xaml", UriKind.Relative)
#endif
#elif WINRT
                Source = new Uri(@"ms-appx:///Sparrow.Chart.WinRT.45/Themes/Styles.xaml")
#elif WP7
#if NET45
                Source = new Uri(@"/Sparrow.Chart.WP7.45;component/Themes/Styles.xaml", UriKind.Relative)
#else
                Source = new Uri(@"/Sparrow.Chart.WP7.40;component/Themes/Styles.xaml", UriKind.Relative)
#endif
#elif WP8
                Source = new Uri(@"/Sparrow.Chart.WP8.45;component/Themes/Styles.xaml", UriKind.Relative)
#endif
#endif
            };
            this.ContainerBorderStyle = styles["containerBorderStyle"] as Style;
        }

        /// <summary>
        /// Called when [axes collection changed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="NotifyCollectionChangedEventArgs"/> instance containing the event data.</param>
        void OnAxesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
        }

        /// <summary>
        /// Called when [series collection changed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="NotifyCollectionChangedEventArgs"/> instance containing the event data.</param>
        void OnSeriesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:

                foreach (SeriesBase series in e.NewItems)
                {
                    Binding dataContextBinding = new Binding {
                        Path = new PropertyPath("DataContext"), Source = this
                    };
                    BindingOperations.SetBinding(series, SeriesBase.DataContextProperty, dataContextBinding);
                    Binding renderingModeBinding = new Binding
                    {
                        Path   = new PropertyPath("RenderingMode"),
                        Source = this
                    };
                    BindingOperations.SetBinding(series, SeriesBase.RenderingModeProperty, renderingModeBinding);
                    series.Chart = this;
                    series.Index = this.Series.IndexOf(series);
                    Binding xAxisBinding = new Binding {
                        Source = this, Path = new PropertyPath("XAxis")
                    };
                    BindingOperations.SetBinding(series, SeriesBase.XAxisProperty, xAxisBinding);
                    Binding yAxisBinding = new Binding {
                        Source = this, Path = new PropertyPath("YAxis")
                    };
                    BindingOperations.SetBinding(series, SeriesBase.YAxisProperty, yAxisBinding);
                    IndexCount = this.Series.Count;
                    if (series is ColumnSeries)
                    {
                        ColumnSeries.Add(series as ColumnSeries);
                    }
                    else if (series is HiLoOpenCloseSeries)
                    {
                        HiLoOpenCloseSeries.Add(series as HiLoOpenCloseSeries);
                    }
                    _isLegendUpdate = false;
                    RefreshLegend();
                }
                break;

#if WPF
            case NotifyCollectionChangedAction.Move:
                break;
#endif
            case NotifyCollectionChangedAction.Remove:
                break;

            case NotifyCollectionChangedAction.Replace:
                break;

            case NotifyCollectionChangedAction.Reset:
                break;
            }
            if (this.Containers != null)
            {
                this.Containers.Refresh();
            }
        }