private void LoadConfiguration()
        {
            StatisticsConfiguration defaultConfig = new StatisticsConfiguration();

            defaultConfig.Charts.Add(new ChartConfiguration()
            {
                StatisticType = StatisticType.Overview, ChartType = StatisticChartType.None
            });
            defaultConfig.Charts.Add(new ChartConfiguration()
            {
                StatisticType = StatisticType.CDGroupByCategoryCount, ChartType = StatisticChartType.Bar
            });
            defaultConfig.Charts.Add(new ChartConfiguration()
            {
                StatisticType = StatisticType.CDGroupByMediumCount, ChartType = StatisticChartType.Column
            });
            defaultConfig.Charts.Add(new ChartConfiguration()
            {
                StatisticType = StatisticType.CDGroupByPriceCount, ChartType = StatisticChartType.Pie
            });

            StatisticsConfiguration config = StatisticsConfiguration.LoadConfiguration(defaultConfig);

            foreach (ChartConfiguration chart in config.Charts)
            {
                AddStatistic(chart.StatisticType, chart.ChartType);
            }
        }
        private void SaveConfiguration()
        {
            if (isChartZoomed)
            {
                return;
            }

            StatisticsConfiguration config = new StatisticsConfiguration();

            foreach (StatisticsItemUserControl statControl in ChartGridOverview.Children)
            {
                ChartConfiguration chart = new ChartConfiguration();

                chart.ChartType     = statControl.StatisticChartType;
                chart.StatisticType = statControl.StatisticType;

                config.Charts.Add(chart);
            }

            config.SaveConfiguration();
        }
        internal static StatisticsConfiguration LoadConfiguration(StatisticsConfiguration defaultConfig)
        {
            object statisticConfigString = Settings.GetValue("StatisticsConfiguration", null);

            if (statisticConfigString == null)
            {
                return(defaultConfig);
            }
            XmlSerializer bf = new XmlSerializer(typeof(StatisticsConfiguration));

            using (StringReader sr = new StringReader(statisticConfigString.ToString()))
            {
                StatisticsConfiguration statisticConfig = (StatisticsConfiguration)bf.Deserialize(sr);

                if (statisticConfig.Charts.Count == 0)
                {
                    return(defaultConfig);
                }
                else
                {
                    return(statisticConfig);
                }
            }
        }