Esempio n. 1
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Food Comparison Chart";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.OverflowMode           = ChartLegendOverflowMode.Wrap;

            PyramidSeries pyramid = new PyramidSeries();

            pyramid.XBindingPath            = "XValue";
            pyramid.YBindingPath            = "YValue";
            pyramid.ItemsSource             = MainPage.GetPyramidData();
            pyramid.ColorModel.ColorPalette = ChartColorPalette.Natural;
            pyramid.TooltipEnabled          = true;
            pyramid.StrokeWidth             = 1;
            pyramid.StrokeColor             = Color.White;
            chart.Series.Add(pyramid);

            ChartTooltipBehavior tooltipBehavior = new ChartTooltipBehavior();

            tooltipBehavior.LabelFormat = "##.## cal";
            chart.Behaviors.Add(tooltipBehavior);

            Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog);

            overflowMode = new List <String>()
            {
                "Wrap", "Scroll"
            };

            ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>
                                                    (context, Android.Resource.Layout.SimpleSpinnerItem, overflowMode);

            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            selectLabelMode.Adapter       = dataAdapter;
            selectLabelMode.ItemSelected += SelectLabelMode_ItemSelected;

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.SetPadding(20, 0, 20, 30);
            linearLayout.SetBackgroundColor(Color.Rgb(236, 235, 242));
            linearLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,
                                                                          LinearLayout.LayoutParams.WrapContent);
            linearLayout.Orientation = Orientation.Vertical;
            linearLayout.SetBackgroundColor(Color.White);

            linearLayout.AddView(selectLabelMode);
            linearLayout.AddView(chart);

            return(linearLayout);
        }
Esempio n. 2
0
        private void OnChartTypeSelectionChanged1(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = sender as ComboBox;

            Accumulation_charts.Legend = null;

            if (comboBox.SelectedIndex == 0 && viewModel != null)
            {
                FunnelSeries series1 = new FunnelSeries();
                series1.Palette    = ChartColorPalette.Custom;
                series1.ColorModel = Resources["customBrush"] as ChartColorModel;

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel = true;

                series1.XBindingPath   = "Category";
                series1.YBindingPath   = "Percentage";
                series1.ItemsSource    = viewModel.list;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 1 && viewModel != null)
            {
                PyramidSeries series1 = new PyramidSeries();
                series1.Palette    = ChartColorPalette.Custom;
                series1.ColorModel = Resources["customBrush"] as ChartColorModel;

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel = true;

                series1.XBindingPath   = "Category";
                series1.YBindingPath   = "Percentage";
                series1.ItemsSource    = viewModel.list;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
        }
Esempio n. 3
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility = Visibility.Visible;

            var pyramidSeries = new PyramidSeries { DataSource = MainPage.GetTriangularData() };

            pyramidSeries.DataMarker.ShowLabel = true;

            chart.Series.Add(pyramidSeries);
            return chart;
        }
Esempio n. 4
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility = Visibility.Visible;

            var pyramidSeries = new PyramidSeries {
                DataSource = MainPage.GetTriangularData()
            };

            pyramidSeries.DataMarker.ShowLabel = true;

            chart.Series.Add(pyramidSeries);
            return(chart);
        }
Esempio n. 5
0
        private void OnChartTypeSelectionChanged1(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = sender as ComboBox;

            Accumulation_charts.Legend = null;

            if (comboBox.SelectedIndex == 0 && viewModel != null)
            {
                if (Accumulation_charts != null)
                {
                    if (Accumulation_charts.Legend == null)
                    {
                        Accumulation_charts.Legend = new ChartLegend()
                        {
                            CornerRadius    = new CornerRadius(0),
                            FontSize        = 15,
                            DockPosition    = ChartDock.Right,
                            BorderThickness = new Thickness(1)
                        };
                    }

                    PieSeries          series1        = new PieSeries();
                    ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                    ChartLegend1.Visibility = Visibility.Visible;

                    DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                    adornmentInfo1.ShowLabel           = true;
                    adornmentInfo1.LabelTemplate       = template1;
                    adornmentInfo1.AdornmentsPosition  = AdornmentsPosition.Bottom;
                    adornmentInfo1.HorizontalAlignment = HorizontalAlignment.Center;
                    adornmentInfo1.VerticalAlignment   = VerticalAlignment.Center;
                    adornmentInfo1.ShowConnectorLine   = true;
                    adornmentInfo1.ConnectorHeight     = 80;
                    adornmentInfo1.ShowLabel           = true;
                    adornmentInfo1.UseSeriesPalette    = true;
                    adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;

                    series1.XBindingPath      = "Countries";
                    series1.YBindingPath      = "Count";
                    series1.ItemsSource       = viewModel.CountryDetails;
                    series1.PieCoefficient    = 0.7;
                    series1.EnableSmartLabels = true;
                    series1.LabelPosition     = CircularSeriesLabelPosition.OutsideExtended;
                    series1.AdornmentsInfo    = adornmentInfo1;
                    series1.GroupMode         = PieGroupMode.Value;
                    series1.GroupTo           = 1000;

                    Accumulation_charts.Header = "Agriculture Expenses Comparison";
                    Accumulation_charts.Series.Clear();
                    Accumulation_charts.Series.Add(series1);
                }
            }
            if (comboBox.SelectedIndex == 1 && viewModel != null)
            {
                PieSeries series1 = new PieSeries();
                PieSeries series2 = new PieSeries();
                PieSeries series3 = new PieSeries();

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo();

                ChartColorModel color1 = new ChartColorModel();
                ChartColorModel color2 = new ChartColorModel();
                ChartColorModel color3 = new ChartColorModel();

                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                DataTemplate template1 = MainGrid.Resources["populationLabelTemplate1"] as DataTemplate;
                DataTemplate template2 = MainGrid.Resources["populationLabelTemplate2"] as DataTemplate;
                DataTemplate template3 = MainGrid.Resources["populationLabelTemplate3"] as DataTemplate;

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo1.LabelTemplate       = template1;

                adornmentInfo2.ShowLabel           = true;
                adornmentInfo2.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo2.LabelTemplate       = template2;

                adornmentInfo3.ShowLabel           = true;
                adornmentInfo3.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo3.LabelTemplate       = template3;

                series1.ItemsSource    = viewModel.Population;
                series1.XBindingPath   = "Continent";
                series1.YBindingPath   = "PopulationinContinents";
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Stroke         = new SolidColorBrush(Colors.White);
                series1.PieCoefficient = 1;
                series1.Label          = "Continents";
                series1.Palette        = ChartColorPalette.Custom;
                series1.ColorModel     = color1;

                series2.ItemsSource    = viewModel.Population;
                series2.XBindingPath   = "Countries";
                series2.YBindingPath   = "PopulationinCountries";
                series2.AdornmentsInfo = adornmentInfo2;
                series2.Stroke         = new SolidColorBrush(Colors.White);
                series2.PieCoefficient = 1;
                series2.Label          = "Countries";
                series2.Palette        = ChartColorPalette.Custom;
                series2.ColorModel     = color2;

                series3.ItemsSource    = viewModel.Population;
                series3.XBindingPath   = "States";
                series3.YBindingPath   = "PopulationinStates";
                series3.AdornmentsInfo = adornmentInfo3;
                series3.Stroke         = new SolidColorBrush(Colors.White);
                series3.PieCoefficient = 1;
                series3.Label          = "States";
                series3.Palette        = ChartColorPalette.Custom;
                series3.ColorModel     = color3;

                Accumulation_charts.Header = "Most populated continents";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
                Accumulation_charts.Series.Add(series2);
                Accumulation_charts.Series.Add(series3);
            }
            if (comboBox.SelectedIndex == 2 && viewModel != null)
            {
                PieSeries          series1        = new PieSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                series1.Margin                     = new Thickness(0, 25, 0, 0);
                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.ShowConnectorLine   = true;
                adornmentInfo1.UseSeriesPalette    = true;
                adornmentInfo1.ConnectorHeight     = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat  = "##.#";

                series1.XBindingPath      = "Utilization";
                series1.YBindingPath      = "ResponseTime";
                series1.StartAngle        = 180;
                series1.EndAngle          = 360;
                series1.EnableSmartLabels = true;
                series1.LabelPosition     = CircularSeriesLabelPosition.Outside;
                series1.ItemsSource       = viewModel.Metric;
                series1.AdornmentsInfo    = adornmentInfo1;

                Accumulation_charts.Header = "Application Performance Metrics";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 3 && viewModel != null)
            {
                if (Accumulation_charts.Legend == null)
                {
                    Accumulation_charts.Legend = new ChartLegend()
                    {
                        CornerRadius    = new CornerRadius(0),
                        FontSize        = 15,
                        DockPosition    = ChartDock.Right,
                        BorderThickness = new Thickness(1)
                    };
                }

                DoughnutSeries     series1        = new DoughnutSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Visible;

                DataTemplate template1 = MainGrid.Resources["labeltemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;

                Accumulation_charts.Series.Clear();
                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 4 && viewModel != null)
            {
                DoughnutSeries series1 = new DoughnutSeries();
                DoughnutSeries series2 = new DoughnutSeries();
                DoughnutSeries series3 = new DoughnutSeries();

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo();

                ChartColorModel color1 = new ChartColorModel();
                ChartColorModel color2 = new ChartColorModel();
                ChartColorModel color3 = new ChartColorModel();

                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                DataTemplate template1 = MainGrid.Resources["populationLabelTemplate1"] as DataTemplate;
                DataTemplate template2 = MainGrid.Resources["populationLabelTemplate2"] as DataTemplate;
                DataTemplate template3 = MainGrid.Resources["populationLabelTemplate3"] as DataTemplate;

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo1.LabelTemplate       = template1;

                adornmentInfo2.ShowLabel           = true;
                adornmentInfo2.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo2.LabelTemplate       = template2;

                adornmentInfo3.ShowLabel           = true;
                adornmentInfo3.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo3.LabelTemplate       = template3;

                series1.ItemsSource         = viewModel.Population;
                series1.XBindingPath        = "Continent";
                series1.YBindingPath        = "PopulationinContinents";
                series1.AdornmentsInfo      = adornmentInfo1;
                series1.Stroke              = new SolidColorBrush(Colors.White);
                series1.DoughnutCoefficient = 1;
                series1.DoughnutSize        = 1;
                series1.Label      = "Continents";
                series1.Palette    = ChartColorPalette.Custom;
                series1.ColorModel = color1;

                series2.ItemsSource         = viewModel.Population;
                series2.XBindingPath        = "Countries";
                series2.YBindingPath        = "PopulationinCountries";
                series2.AdornmentsInfo      = adornmentInfo2;
                series2.Stroke              = new SolidColorBrush(Colors.White);
                series2.DoughnutCoefficient = 1;
                series2.DoughnutSize        = 1;
                series2.Label      = "Countries";
                series2.Palette    = ChartColorPalette.Custom;
                series2.ColorModel = color2;

                series3.ItemsSource         = viewModel.Population;
                series3.XBindingPath        = "States";
                series3.YBindingPath        = "PopulationinStates";
                series3.AdornmentsInfo      = adornmentInfo3;
                series3.Stroke              = new SolidColorBrush(Colors.White);
                series3.DoughnutCoefficient = 1;
                series3.DoughnutSize        = 1;
                series3.Label      = "States";
                series3.Palette    = ChartColorPalette.Custom;
                series3.ColorModel = color3;

                Accumulation_charts.Header = "Most populated continents";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
                Accumulation_charts.Series.Add(series2);
                Accumulation_charts.Series.Add(series3);
            }
            if (comboBox.SelectedIndex == 5 && viewModel != null)
            {
                DoughnutSeries     series1        = new DoughnutSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.ShowConnectorLine   = true;
                adornmentInfo1.UseSeriesPalette    = true;
                adornmentInfo1.ConnectorHeight     = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat  = "##.#";

                series1.XBindingPath      = "Utilization";
                series1.YBindingPath      = "ResponseTime";
                series1.StartAngle        = 180;
                series1.EndAngle          = 360;
                series1.EnableSmartLabels = true;
                series1.LabelPosition     = CircularSeriesLabelPosition.Outside;
                series1.Margin            = new Thickness(0, 25, 0, 0);
                series1.ItemsSource       = viewModel.Metric;
                series1.AdornmentsInfo    = adornmentInfo1;

                Accumulation_charts.Header = "Application Performance Metrics";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 6 && viewModel != null)
            {
                DoughnutSeries doughnutSeries = new DoughnutSeries();
                doughnutSeries.DataContext         = viewModel;
                doughnutSeries.XBindingPath        = "XValue";
                doughnutSeries.YBindingPath        = "YValue";
                doughnutSeries.ItemsSource         = (doughnutSeries.DataContext as PieChartViewModel).DoughnutSeriesData;
                doughnutSeries.IsStackedDoughnut   = true;
                doughnutSeries.EnableAnimation     = true;
                doughnutSeries.LegendIcon          = ChartLegendIcon.Circle;
                doughnutSeries.StartAngle          = -90;
                doughnutSeries.EndAngle            = 270;
                doughnutSeries.SegmentSpacing      = 0.2;
                doughnutSeries.DoughnutCoefficient = 0.8;
                doughnutSeries.CapStyle            = DoughnutCapStyle.BothCurve;
                doughnutSeries.MaximumValue        = 100;

                var colorModel    = new ChartColorModel();
                var customBrushes = new List <Brush>();
                customBrushes.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x47, 0xBA, 0x9F)));
                customBrushes.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE5, 0x88, 0x70)));
                customBrushes.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x96, 0x86, 0xC9)));
                customBrushes.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE5, 0x65, 0x90)));

                colorModel.CustomBrushes  = customBrushes;
                doughnutSeries.ColorModel = colorModel;
                doughnutSeries.Palette    = ChartColorPalette.Custom;
                var image = new Image()
                {
                    Source = new BitmapImage(new Uri("ms-appx:///Chart/Tutorials/ChartSamples/PieChart/Images/Person.png", UriKind.RelativeOrAbsolute))
                };
                var centerView = new ContentControl()
                {
                    Content = image, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
                };

                var binding = new Binding();
                binding.Source             = doughnutSeries;
                binding.Path               = new PropertyPath("InnerRadius");
                binding.Converter          = new ImageSizeConverter();
                binding.ConverterParameter = doughnutSeries;
                binding.Mode               = BindingMode.TwoWay;
                centerView.SetBinding(ContentControl.WidthProperty, binding);
                centerView.SetBinding(ContentControl.HeightProperty, binding);
                doughnutSeries.CenterView = centerView;

                var legend = new ChartLegend()
                {
                    DockPosition = ChartDock.Bottom
                };
                legend.ItemTemplate = MainGrid.Resources["stackedDoughnutTemplate"] as DataTemplate;

                Accumulation_charts.Legend = legend;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(doughnutSeries);
                Accumulation_charts.Header = "Percentage of Loan Closure";
            }
            if (comboBox.SelectedIndex == 7 && viewModel != null)
            {
                PyramidSeries      series1        = new PyramidSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 8 && viewModel != null)
            {
                FunnelSeries       series1        = new FunnelSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
        }
Esempio n. 6
0
        private List <Hashtable> SeriesToHashtables(List <Series> listOfSeries)
        {
            List <Hashtable> hashtableList = new List <Hashtable>();

            foreach (Series series in listOfSeries)
            {
                List <object> dataList  = new List <object>();
                Hashtable     hashtable = new Hashtable();
                if (series is LineSeries)
                {
                    LineSeries lineSeries = series as LineSeries;
                    lineSeries.Data.ForEach(
                        (Action <LineSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    lineSeries.Type = LineSeriesType.Line;
                    hashtable       = lineSeries.ToHashtable();
                }
                if (series is SplineSeries)
                {
                    SplineSeries splineSeries = series as SplineSeries;
                    splineSeries.Data.ForEach((Action <SplineSeriesData>)(data =>
                                                                          dataList.Add((object)data.ToHashtable())));
                    splineSeries.Type = SplineSeriesType.Spline;
                    hashtable         = splineSeries.ToHashtable();
                }
                if (series is AreaSeries)
                {
                    AreaSeries areaSeries = series as AreaSeries;
                    areaSeries.Data.ForEach(
                        (Action <AreaSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    areaSeries.Type = AreaSeriesType.Area;
                    hashtable       = areaSeries.ToHashtable();
                }
                if (series is AreasplineSeries)
                {
                    AreasplineSeries areasplineSeries = series as AreasplineSeries;
                    areasplineSeries.Data.ForEach(
                        (Action <AreasplineSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    areasplineSeries.Type = AreasplineSeriesType.Areaspline;
                    hashtable             = areasplineSeries.ToHashtable();
                }
                if (series is ArearangeSeries)
                {
                    ArearangeSeries arearangeSeries = series as ArearangeSeries;
                    arearangeSeries.Data.ForEach(
                        (Action <ArearangeSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    arearangeSeries.Type = ArearangeSeriesType.Arearange;
                    hashtable            = arearangeSeries.ToHashtable();
                }
                if (series is ColumnrangeSeries)
                {
                    ColumnrangeSeries columnrangeSeries = series as ColumnrangeSeries;
                    columnrangeSeries.Data.ForEach(
                        (Action <ColumnrangeSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    columnrangeSeries.Type = ColumnrangeSeriesType.Columnrange;
                    hashtable = columnrangeSeries.ToHashtable();
                }
                if (series is BarSeries)
                {
                    BarSeries barSeries = series as BarSeries;
                    barSeries.Data.ForEach((Action <BarSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    barSeries.Type = BarSeriesType.Bar;
                    hashtable      = barSeries.ToHashtable();
                }
                if (series is ColumnSeries)
                {
                    ColumnSeries columnSeries = series as ColumnSeries;
                    columnSeries.Data.ForEach((Action <ColumnSeriesData>)(data =>
                                                                          dataList.Add((object)data.ToHashtable())));
                    columnSeries.Type = ColumnSeriesType.Column;
                    hashtable         = columnSeries.ToHashtable();
                }
                if (series is PieSeries)
                {
                    PieSeries pieSeries = series as PieSeries;
                    pieSeries.Data.ForEach((Action <PieSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    pieSeries.Type = PieSeriesType.Pie;
                    hashtable      = pieSeries.ToHashtable();
                }
                if (series is ScatterSeries)
                {
                    ScatterSeries scatterSeries = series as ScatterSeries;
                    scatterSeries.Data.ForEach(
                        (Action <ScatterSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    scatterSeries.Type = ScatterSeriesType.Scatter;
                    hashtable          = scatterSeries.ToHashtable();
                }
                if (series is BubbleSeries)
                {
                    BubbleSeries bubbleSeries = series as BubbleSeries;
                    bubbleSeries.Data.ForEach((Action <BubbleSeriesData>)(data =>
                                                                          dataList.Add((object)data.ToHashtable())));
                    bubbleSeries.Type = BubbleSeriesType.Bubble;
                    hashtable         = bubbleSeries.ToHashtable();
                }
                if (series is GaugeSeries)
                {
                    GaugeSeries gaugeSeries = series as GaugeSeries;
                    gaugeSeries.Data.ForEach((Action <GaugeSeriesData>)(data =>
                                                                        dataList.Add((object)data.ToHashtable())));
                    gaugeSeries.Type = GaugeSeriesType.Gauge;
                    hashtable        = gaugeSeries.ToHashtable();
                }
                if (series is SolidgaugeSeries)
                {
                    SolidgaugeSeries solidgaugeSeries = series as SolidgaugeSeries;
                    solidgaugeSeries.Data.ForEach(
                        (Action <SolidgaugeSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    solidgaugeSeries.Type = SolidgaugeSeriesType.Solidgauge;
                    hashtable             = solidgaugeSeries.ToHashtable();
                }
                if (series is HeatmapSeries)
                {
                    HeatmapSeries heatmapSeries = series as HeatmapSeries;
                    heatmapSeries.Data.ForEach(
                        (Action <HeatmapSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    heatmapSeries.Type = HeatmapSeriesType.Heatmap;
                    hashtable          = heatmapSeries.ToHashtable();
                }
                if (series is BoxplotSeries)
                {
                    BoxplotSeries boxplotSeries = series as BoxplotSeries;
                    boxplotSeries.Data.ForEach(
                        (Action <BoxplotSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    boxplotSeries.Type = BoxplotSeriesType.Boxplot;
                    hashtable          = boxplotSeries.ToHashtable();
                }
                if (series is ErrorbarSeries)
                {
                    ErrorbarSeries errorbarSeries = series as ErrorbarSeries;
                    errorbarSeries.Data.ForEach(
                        (Action <ErrorbarSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    errorbarSeries.Type = ErrorbarSeriesType.Errorbar;
                    hashtable           = errorbarSeries.ToHashtable();
                }
                if (series is FunnelSeries)
                {
                    FunnelSeries funnelSeries = series as FunnelSeries;
                    funnelSeries.Data.ForEach((Action <FunnelSeriesData>)(data =>
                                                                          dataList.Add((object)data.ToHashtable())));
                    funnelSeries.Type = FunnelSeriesType.Funnel;
                    hashtable         = funnelSeries.ToHashtable();
                }
                if (series is PyramidSeries)
                {
                    PyramidSeries pyramidSeries = series as PyramidSeries;
                    pyramidSeries.Data.ForEach(
                        (Action <PyramidSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    pyramidSeries.Type = PyramidSeriesType.Pyramid;
                    hashtable          = pyramidSeries.ToHashtable();
                }
                if (series is WaterfallSeries)
                {
                    WaterfallSeries waterfallSeries = series as WaterfallSeries;
                    waterfallSeries.Data.ForEach(
                        (Action <WaterfallSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    waterfallSeries.Type = WaterfallSeriesType.Waterfall;
                    hashtable            = waterfallSeries.ToHashtable();
                }
                if (series is PolygonSeries)
                {
                    PolygonSeries polygonSeries = series as PolygonSeries;
                    polygonSeries.Data.ForEach(
                        (Action <PolygonSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    polygonSeries.Type = PolygonSeriesType.Polygon;
                    hashtable          = polygonSeries.ToHashtable();
                }
                if (series is TreemapSeries)
                {
                    TreemapSeries treemapSeries = series as TreemapSeries;
                    treemapSeries.Data.ForEach(
                        (Action <TreemapSeriesData>)(data => dataList.Add((object)data.ToHashtable())));
                    treemapSeries.Type = TreemapSeriesType.Treemap;
                    hashtable          = treemapSeries.ToHashtable();
                }
                hashtableList.Add(hashtable);
            }
            return(hashtableList);
        }
Esempio n. 7
0
        private void OnChartTypeSelectionChanged1(object sender, SelectionChangedEventArgs e) {
            ComboBox comboBox = sender as ComboBox;
            if (comboBox.SelectedIndex == 0 && viewModel != null) {
                if (Accumulation_charts != null) {
                    Accumulation_charts.Header = "Agriculture Expenses Comparison";
                    PieSeries series1 = new PieSeries();
                    DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                    ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                    adornmentInfo1.ShowLabel = true;
                    ChartLegend1.Visibility = Visibility.Visible;
                    series1.XBindingPath = "Expense";
                    series1.YBindingPath = "Amount";
                    series1.ItemsSource = viewModel.Expenditure;
                    series1.ConnectorType = ConnectorMode.Bezier;
                    series1.PieCoefficient = 0.7;
                    series1.EnableSmartLabels = true;
                    series1.LabelPosition = CircularSeriesLabelPosition.OutsideExtended;
                    adornmentInfo1.LabelTemplate = template1;
                    adornmentInfo1.AdornmentsPosition = AdornmentsPosition.Bottom;
                    adornmentInfo1.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
                    adornmentInfo1.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
                    adornmentInfo1.ShowConnectorLine = true;
                    adornmentInfo1.ConnectorHeight = 80;
                    adornmentInfo1.ShowLabel = true;
                    adornmentInfo1.UseSeriesPalette = true;
                    adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;
                    series1.AdornmentsInfo = adornmentInfo1;
                    Accumulation_charts.Series.Clear();
                    Accumulation_charts.Series.Add(series1);
                }
            }

            if (comboBox.SelectedIndex == 2 && viewModel != null) {
                Accumulation_charts.Header = "Top car company's turnover";
                DoughnutSeries series1 = new DoughnutSeries();
                DataTemplate template1 = MainGrid.Resources["labeltemplate"] as DataTemplate;
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                adornmentInfo1.ShowLabel = true;
                ChartLegend1.Visibility = Visibility.Visible;
                series1.XBindingPath = "CompanyName";
                series1.YBindingPath = "CompanyTurnover";
                series1.ItemsSource = viewModel.CompanyDetails;
                adornmentInfo1.LabelTemplate = template1;
                series1.AdornmentsInfo = adornmentInfo1;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }

            if (comboBox.SelectedIndex == 4 && viewModel != null) {
                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                PyramidSeries series1 = new PyramidSeries();
                series1.Margin = new Thickness(20, 0, 20, 20);
                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                adornmentInfo1.ShowLabel = true;
                ChartLegend1.Visibility = Visibility.Collapsed;
                series1.XBindingPath = "CompanyName";
                series1.YBindingPath = "CompanyTurnover";
                series1.ItemsSource = viewModel.CompanyDetails;
                adornmentInfo1.LabelTemplate = template1;
                series1.AdornmentsInfo = adornmentInfo1;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }

            if (comboBox.SelectedIndex == 5 && viewModel != null) {
                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                FunnelSeries series1 = new FunnelSeries();
                series1.Margin = new Thickness(20, 0, 20, 20);
                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                adornmentInfo1.ShowLabel = true;
                ChartLegend1.Visibility = Visibility.Collapsed;
                series1.XBindingPath = "CompanyName";
                series1.YBindingPath = "CompanyTurnover";
                series1.ItemsSource = viewModel.CompanyDetails;
                adornmentInfo1.LabelTemplate = template1;
                series1.AdornmentsInfo = adornmentInfo1;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 1 && viewModel != null) {
                Accumulation_charts.Header = "Application Performance Metrics";
                ChartLegend1.Visibility = Visibility.Collapsed;
                PieSeries series1 = new PieSeries();
                series1.Margin = new Thickness(0, 25, 0, 0);
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                adornmentInfo1.ShowLabel = true;
                adornmentInfo1.ShowConnectorLine = true;
                adornmentInfo1.UseSeriesPalette = true;
                adornmentInfo1.ConnectorHeight = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat = "##.#";
                series1.XBindingPath = "Utilization";
                series1.YBindingPath = "ResponseTime";
                series1.StartAngle = 180;
                series1.EndAngle = 360;
                series1.ConnectorType = ConnectorMode.Bezier;
                series1.EnableSmartLabels = true;
                series1.LabelPosition = CircularSeriesLabelPosition.Outside;
                series1.ItemsSource = viewModel.Metric;
                series1.AdornmentsInfo = adornmentInfo1;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }

            if (comboBox.SelectedIndex == 3 && viewModel != null) {
                Accumulation_charts.Header = "Application Performance Metrics";
                ChartLegend1.Visibility = Visibility.Collapsed;
                DoughnutSeries series1 = new DoughnutSeries();
                series1.Margin = new Thickness(0, 25, 0, 0);
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                adornmentInfo1.ShowLabel = true;
                adornmentInfo1.ShowConnectorLine = true;
                adornmentInfo1.UseSeriesPalette = true;
                adornmentInfo1.ConnectorHeight = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat = "##.#";
                series1.XBindingPath = "Utilization";
                series1.YBindingPath = "ResponseTime";
                series1.StartAngle = 180;
                series1.EndAngle = 360;
                series1.ConnectorType = ConnectorMode.Bezier;
                series1.EnableSmartLabels = true;
                series1.LabelPosition = CircularSeriesLabelPosition.Outside;
                series1.ItemsSource = viewModel.Metric;
                series1.AdornmentsInfo = adornmentInfo1;
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }


        }
Esempio n. 8
0
        private void OnChartTypeSelectionChanged1(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = sender as ComboBox;

            if (comboBox.SelectedIndex == 0 && viewModel != null)
            {
                if (Accumulation_charts != null)
                {
                    PieSeries          series1        = new PieSeries();
                    ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                    ChartLegend1.Visibility = Visibility.Visible;

                    DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                    adornmentInfo1.ShowLabel           = true;
                    adornmentInfo1.LabelTemplate       = template1;
                    adornmentInfo1.AdornmentsPosition  = AdornmentsPosition.Bottom;
                    adornmentInfo1.HorizontalAlignment = HorizontalAlignment.Center;
                    adornmentInfo1.VerticalAlignment   = VerticalAlignment.Center;
                    adornmentInfo1.ShowConnectorLine   = true;
                    adornmentInfo1.ConnectorHeight     = 80;
                    adornmentInfo1.ShowLabel           = true;
                    adornmentInfo1.UseSeriesPalette    = true;
                    adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;

                    series1.XBindingPath      = "Expense";
                    series1.YBindingPath      = "Amount";
                    series1.ItemsSource       = viewModel.Expenditure;
                    series1.ConnectorType     = ConnectorMode.Bezier;
                    series1.PieCoefficient    = 0.7;
                    series1.EnableSmartLabels = true;
                    series1.LabelPosition     = CircularSeriesLabelPosition.OutsideExtended;
                    series1.AdornmentsInfo    = adornmentInfo1;

                    Accumulation_charts.Header = "Agriculture Expenses Comparison";
                    Accumulation_charts.Series.Clear();
                    Accumulation_charts.Series.Add(series1);
                }
            }
            if (comboBox.SelectedIndex == 1 && viewModel != null)
            {
                PieSeries series1 = new PieSeries();
                PieSeries series2 = new PieSeries();
                PieSeries series3 = new PieSeries();

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo();

                ChartColorModel color1 = new ChartColorModel();
                ChartColorModel color2 = new ChartColorModel();
                ChartColorModel color3 = new ChartColorModel();

                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                DataTemplate template1 = MainGrid.Resources["populationLabelTemplate1"] as DataTemplate;
                DataTemplate template2 = MainGrid.Resources["populationLabelTemplate2"] as DataTemplate;
                DataTemplate template3 = MainGrid.Resources["populationLabelTemplate3"] as DataTemplate;

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo1.LabelTemplate       = template1;

                adornmentInfo2.ShowLabel           = true;
                adornmentInfo2.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo2.LabelTemplate       = template2;

                adornmentInfo3.ShowLabel           = true;
                adornmentInfo3.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo3.LabelTemplate       = template3;

                series1.ItemsSource    = viewModel.Population;
                series1.XBindingPath   = "Continent";
                series1.YBindingPath   = "PopulationinContinents";
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Stroke         = new SolidColorBrush(Colors.White);
                series1.PieCoefficient = 1;
                series1.Label          = "Continents";
                series1.Palette        = ChartColorPalette.Custom;
                series1.ColorModel     = color1;

                series2.ItemsSource    = viewModel.Population;
                series2.XBindingPath   = "Countries";
                series2.YBindingPath   = "PopulationinCountries";
                series2.AdornmentsInfo = adornmentInfo2;
                series2.Stroke         = new SolidColorBrush(Colors.White);
                series2.PieCoefficient = 1;
                series2.Label          = "Countries";
                series2.Palette        = ChartColorPalette.Custom;
                series2.ColorModel     = color2;

                series3.ItemsSource    = viewModel.Population;
                series3.XBindingPath   = "States";
                series3.YBindingPath   = "PopulationinStates";
                series3.AdornmentsInfo = adornmentInfo3;
                series3.Stroke         = new SolidColorBrush(Colors.White);
                series3.PieCoefficient = 1;
                series3.Label          = "States";
                series3.Palette        = ChartColorPalette.Custom;
                series3.ColorModel     = color3;

                Accumulation_charts.Header = "Most populated continents";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
                Accumulation_charts.Series.Add(series2);
                Accumulation_charts.Series.Add(series3);
            }
            if (comboBox.SelectedIndex == 2 && viewModel != null)
            {
                PieSeries          series1        = new PieSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                series1.Margin                     = new Thickness(0, 25, 0, 0);
                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.ShowConnectorLine   = true;
                adornmentInfo1.UseSeriesPalette    = true;
                adornmentInfo1.ConnectorHeight     = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat  = "##.#";

                series1.XBindingPath      = "Utilization";
                series1.YBindingPath      = "ResponseTime";
                series1.StartAngle        = 180;
                series1.EndAngle          = 360;
                series1.ConnectorType     = ConnectorMode.Bezier;
                series1.EnableSmartLabels = true;
                series1.LabelPosition     = CircularSeriesLabelPosition.Outside;
                series1.ItemsSource       = viewModel.Metric;
                series1.AdornmentsInfo    = adornmentInfo1;

                Accumulation_charts.Header = "Application Performance Metrics";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 3 && viewModel != null)
            {
                DoughnutSeries     series1        = new DoughnutSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Visible;

                DataTemplate template1 = MainGrid.Resources["labeltemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;

                Accumulation_charts.Series.Clear();
                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 4 && viewModel != null)
            {
                DoughnutSeries series1 = new DoughnutSeries();
                DoughnutSeries series2 = new DoughnutSeries();
                DoughnutSeries series3 = new DoughnutSeries();

                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo();
                ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo();

                ChartColorModel color1 = new ChartColorModel();
                ChartColorModel color2 = new ChartColorModel();
                ChartColorModel color3 = new ChartColorModel();

                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color1.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color2.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 233, 70, 73)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 15, 185, 84)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));
                color3.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 82, 119)));

                DataTemplate template1 = MainGrid.Resources["populationLabelTemplate1"] as DataTemplate;
                DataTemplate template2 = MainGrid.Resources["populationLabelTemplate2"] as DataTemplate;
                DataTemplate template3 = MainGrid.Resources["populationLabelTemplate3"] as DataTemplate;

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo1.LabelTemplate       = template1;

                adornmentInfo2.ShowLabel           = true;
                adornmentInfo2.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo2.LabelTemplate       = template2;

                adornmentInfo3.ShowLabel           = true;
                adornmentInfo3.SegmentLabelContent = LabelContent.LabelContentPath;
                adornmentInfo3.LabelTemplate       = template3;

                series1.ItemsSource         = viewModel.Population;
                series1.XBindingPath        = "Continent";
                series1.YBindingPath        = "PopulationinContinents";
                series1.AdornmentsInfo      = adornmentInfo1;
                series1.Stroke              = new SolidColorBrush(Colors.White);
                series1.DoughnutCoefficient = 1;
                series1.DoughnutSize        = 1;
                series1.Label      = "Continents";
                series1.Palette    = ChartColorPalette.Custom;
                series1.ColorModel = color1;

                series2.ItemsSource         = viewModel.Population;
                series2.XBindingPath        = "Countries";
                series2.YBindingPath        = "PopulationinCountries";
                series2.AdornmentsInfo      = adornmentInfo2;
                series2.Stroke              = new SolidColorBrush(Colors.White);
                series2.DoughnutCoefficient = 1;
                series2.DoughnutSize        = 1;
                series2.Label      = "Countries";
                series2.Palette    = ChartColorPalette.Custom;
                series2.ColorModel = color2;

                series3.ItemsSource         = viewModel.Population;
                series3.XBindingPath        = "States";
                series3.YBindingPath        = "PopulationinStates";
                series3.AdornmentsInfo      = adornmentInfo3;
                series3.Stroke              = new SolidColorBrush(Colors.White);
                series3.DoughnutCoefficient = 1;
                series3.DoughnutSize        = 1;
                series3.Label      = "States";
                series3.Palette    = ChartColorPalette.Custom;
                series3.ColorModel = color3;

                Accumulation_charts.Header = "Most populated continents";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
                Accumulation_charts.Series.Add(series2);
                Accumulation_charts.Series.Add(series3);
            }
            if (comboBox.SelectedIndex == 5 && viewModel != null)
            {
                DoughnutSeries     series1        = new DoughnutSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                adornmentInfo1.ShowLabel           = true;
                adornmentInfo1.ShowConnectorLine   = true;
                adornmentInfo1.UseSeriesPalette    = true;
                adornmentInfo1.ConnectorHeight     = 37;
                adornmentInfo1.SegmentLabelContent = LabelContent.Percentage;
                adornmentInfo1.SegmentLabelFormat  = "##.#";

                series1.XBindingPath      = "Utilization";
                series1.YBindingPath      = "ResponseTime";
                series1.StartAngle        = 180;
                series1.EndAngle          = 360;
                series1.ConnectorType     = ConnectorMode.Bezier;
                series1.EnableSmartLabels = true;
                series1.LabelPosition     = CircularSeriesLabelPosition.Outside;
                series1.Margin            = new Thickness(0, 25, 0, 0);
                series1.ItemsSource       = viewModel.Metric;
                series1.AdornmentsInfo    = adornmentInfo1;

                Accumulation_charts.Header = "Application Performance Metrics";
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 6 && viewModel != null)
            {
                PyramidSeries      series1        = new PyramidSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
            if (comboBox.SelectedIndex == 7 && viewModel != null)
            {
                FunnelSeries       series1        = new FunnelSeries();
                ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo();

                ChartLegend1.Visibility = Visibility.Collapsed;

                DataTemplate template1 = MainGrid.Resources["labelTemplate"] as DataTemplate;
                adornmentInfo1.ShowLabel     = true;
                adornmentInfo1.LabelTemplate = template1;

                series1.XBindingPath   = "CompanyName";
                series1.YBindingPath   = "CompanyTurnover";
                series1.ItemsSource    = viewModel.CompanyDetails;
                series1.AdornmentsInfo = adornmentInfo1;
                series1.Margin         = new Thickness(20, 0, 20, 20);

                Accumulation_charts.Header = "Top car company's turnover";
                Accumulation_charts.Margin = new Thickness(20, 20, 20, 20);
                Accumulation_charts.Series.Clear();
                Accumulation_charts.Series.Add(series1);
            }
        }