protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "Education Distribution";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;

            this.flexChart1.DataSource = Demographics.GetPopulationEducation();
            this.flexChart1.BindingX   = "Name";
            this.flexChart1.Stacking   = Stacking.Stacked100pc;

            var iMalePop = new Series
            {
                Name          = "Male",
                Binding       = "IlliterateMale",
                StackingGroup = 0,
                LegendGroup   = "Illiterate"
            };

            var iFemalePop = new Series
            {
                Name          = "Female",
                Binding       = "IlliterateFemale",
                StackingGroup = 0,
                LegendGroup   = "Illiterate"
            };

            var malePop = new Series
            {
                Name          = "Male",
                Binding       = "EducatedMale",
                LegendGroup   = "Literate",
                StackingGroup = 1,
            };

            var femalePop = new Series
            {
                Name          = "Female",
                Binding       = "EducatedFemale",
                LegendGroup   = "Literate",
                StackingGroup = 1,
            };

            this.flexChart1.Series.Add(iMalePop);
            this.flexChart1.Series.Add(iFemalePop);
            this.flexChart1.Series.Add(malePop);
            this.flexChart1.Series.Add(femalePop);

            this.flexChart1.AxisY.Format    = "P0";
            this.flexChart1.Legend.Position = Position.Right;

            this.flexChart1.Legend.GroupHeaderStyle.Font = StyleInfo.LegendGroupHeaderFont;
            this.flexChart1.ToolTip.Content = "{y:0}";
            this.flexChart1.Rendered       += (s, e) => { _cbStacking.SelectedItem = flexChart1.Stacking; };
        }
        protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "Populous Countries";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;

            this.flexChart1.DataSource = Demographics.GetPopulationEducation().OrderByDescending(x => x.TotalPopulation);
            this.flexChart1.BindingX   = "Name";
            this.flexChart1.Series.Add(new Series {
                Name = "Population", Binding = "TotalPopulation"
            });

            this.flexChart1.AxisY.Format    = "#,##0,,M";
            this.flexChart1.ToolTip.Content = "{y:0}";
        }
        protected override void SetupChart()
        {
            var data = Demographics.GetPopulationEducation();

            data = data.OrderBy(x => x.MalePopulation + x.FemalePopulation).ToList();

            this.flexChart1.ChartType         = ChartType.Bar;
            this.flexChart1.Header.Content    = "Population Pyramid";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;

            this.flexChart1.DataSource = data;
            this.flexChart1.BindingX   = "Name";
            this.flexChart1.PlotAreas.Add(new PlotArea {
                Name = "plot1", Column = 0
            });
            this.flexChart1.PlotAreas.Add(new PlotArea {
                Name = "plot2", Column = 1
            });

            var males = new Series()
            {
                Name      = "Male", Binding = "MalePopulation",
                DataLabel = new DataLabel {
                    Content = "{y: #,##0,,M}", Position = LabelPosition.Right
                },
                AxisX = new Axis {
                    Position = Position.Bottom, PlotAreaName = "plot1", Reversed = true, AxisLine = false, Labels = false, MinorTickMarks = TickMark.None, LogBase = 10, Min = 1000000
                },
            };
            var females = new Series
            {
                Name      = "Female", Binding = "FemalePopulation",
                DataLabel = new DataLabel {
                    Content = "{y: #,##0,,M}", Position = LabelPosition.Left
                },
                AxisX = new Axis {
                    Position = Position.Bottom, PlotAreaName = "plot2", AxisLine = false, Labels = false, MinorTickMarks = TickMark.None, LogBase = 10, Min = 1000000
                },
            };

            this.flexChart1.Series.Add(males);
            this.flexChart1.Series.Add(females);

            this.flexChart1.DataLabel.Overlapping = LabelOverlapping.Show;
            this.flexChart1.AxisX.AxisLine        = false;
            this.flexChart1.AxisY.MajorGrid       = false;
            this.flexChart1.AxisY.MajorTickMarks  = TickMark.Outside;
        }
Ejemplo n.º 4
0
        protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "Education Distribution";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;

            this.flexChart1.DataSource = Demographics.GetPopulationEducation();
            this.flexChart1.BindingX   = "Name";

            this.flexChart1.Series.Add(new Series {
                Name = "Total Population", Binding = "TotalPopulation"
            });
            this.flexChart1.Series.Add(new Series {
                Name = "Educated Population", Binding = "EducatedPopulation"
            });

            this.flexChart1.AxisY.Format        = "#,##0,,M";
            this.flexChart1.ToolTip.Content     = "{y:0}";
            this.flexChart1.Legend.ItemMaxWidth = 50;
            this.flexChart1.Rendered           += (s, e) => { _cbPosition.SelectedItem = flexChart1.Legend.Position; };
        }
        protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "Population Share";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;

            this.flexChart1.DataSource = Demographics.GetPopulationEducation();
            this.flexChart1.BindingX   = "Name";
            this.flexChart1.Series.Add(new Series {
                Name = "Male", Binding = "MalePopulation"
            });
            this.flexChart1.Series.Add(new Series {
                Name = "Female", Binding = "FemalePopulation"
            });

            this.flexChart1.AxisY.Format    = "#,##0,,M";
            this.flexChart1.Stacking        = Stacking.Stacked;
            this.flexChart1.ToolTip.Content = "{y:0}";
            this.flexChart1.Rendered       += (s, e) =>
            {
                _cbStacking.SelectedItem = this.flexChart1.Stacking;
            };
        }