Example #1
0
        private void LoadPieChart(int flag = 0)
        {
            PieSeries.Clear();

            PieSeries pie = null;

            foreach (var range in NumRanges)
            {
                double min = range.Min.HasValue ? (double)range.Min : 0;
                double max = range.Max.HasValue ? (double)range.Max : 100000;
                pie = new PieSeries
                {
                    Title  = range.Title,
                    Values = new ChartValues <int>
                    {
                        PartyBuildingContext.org2news.Count(
                            o => flag == 0?
                            o.mem_count_dy >= min && o.mem_count_dy < max:
                            o.emp_count >= min && o.emp_count < max
                            )
                    },
                    DataLabels = true,
                    PushOut    = 2,
                    LabelPoint = PiePointLabel
                };
                PieSeries.Add(pie);
            }
        }
Example #2
0
        private void LoadPiesAction(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            PieSeries.Clear();
            string pieType = parameter.ToString();

            switch (pieType)
            {
            case "type":
                ChartHelper.LoadPies(PieSeries, allDysj.GroupBy(m => (string)m.type), PiePointLabel);
                break;

            case "town":
                ChartHelper.LoadPies(PieSeries, allDysj.GroupBy(m => (string)m.town), PiePointLabel);
                break;

            case "sex":
                ChartHelper.LoadPies(PieSeries, allDysj.GroupBy(m => (string)m.sex), PiePointLabel);
                break;

            case "age":
                double min, max;
                foreach (var range in ChartHelper.AgeRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allDysj.Count(m => Convert.ToInt32(m.age) >= min && Convert.ToInt32(m.age) < max)
                    },
                                        PiePointLabel);
                }
                break;

            case "nation":
                ChartHelper.LoadPies(PieSeries, allDysj.GroupBy(m => (string)m.nation), PiePointLabel);
                break;

            case "xl":
                ChartHelper.LoadPies(PieSeries, allDysj.GroupBy(m => (string)m.xl), PiePointLabel);
                break;

            default:
                break;
            }
        }
Example #3
0
        private void LoadPiesAction(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            PieSeries.Clear();
            string pieType = parameter.ToString();

            switch (pieType)
            {
            case "town":
                ChartHelper.LoadPies(PieSeries, allOrgs.GroupBy(m => m.town), PiePointLabel);
                break;

            case "type":
                ChartHelper.LoadPies(PieSeries, allOrgs.GroupBy(m => m.org_type), PiePointLabel);
                break;

            case "dy_zs":
                double min, max;
                foreach (var range in DyRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allOrgs.Count(m => m.dy_zs >= min && m.dy_zs < max)
                    },
                                        PiePointLabel);
                }
                break;

            default:
                break;
            }
        }
        private void CreateLegend()
        {
            PieSeries.Clear();

            var pieChart = FindParent <PieChart>(this);

            if (pieChart == null)
            {
                return;
            }

            var seriesCollection = pieChart.Series;

            foreach (var series in seriesCollection)
            {
                var pieSeries = series as PieSeries;
                if (pieSeries != null)
                {
                    var item = new PieSeriesViewModel();
                    item.Fill            = pieSeries.Fill;
                    item.PointGeometry   = pieSeries.PointGeometry;
                    item.Stroke          = pieSeries.Stroke;
                    item.StrokeThickness = pieSeries.StrokeThickness;
                    item.Title           = pieSeries.Title;

                    var values          = pieSeries.Values.GetPoints(pieSeries);
                    var firstChartPoint = values.First();

                    item.Value      = string.Format(ValueFormat, firstChartPoint.Y);
                    item.Percentage = string.Format(PercentFormat, firstChartPoint.Participation);


                    PieSeries.Add(item);
                }
            }
        }
Example #5
0
        private void LoadPiesAction(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            PieSeries.Clear();
            string pieType = parameter.ToString();
            double min, max;

            switch (pieType)
            {
            case "town":
                ChartHelper.LoadPies(PieSeries, allActPlaces.GroupBy(m => (string)m.town), PiePointLabel);
                break;

            case "levels":
                foreach (var range in LevelRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allActPlaces.Count(m => Convert.ToInt32(m.levels) >= min && Convert.ToInt32(m.levels) < max)
                    },
                                        PiePointLabel);
                }
                break;

            case "rooms":
                foreach (var range in RoomRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allActPlaces.Count(m => Convert.ToInt32(m.rooms) >= min && Convert.ToInt32(m.rooms) < max)
                    },
                                        PiePointLabel);
                }
                break;

            case "area_jz":
                foreach (var range in AreaRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allActPlaces.Count(m => Convert.ToInt32(m.floor_area) >= min && Convert.ToInt32(m.floor_area) < max)
                    },
                                        PiePointLabel);
                }
                break;

            case "area_yl":
                foreach (var range in AreaRanges)
                {
                    min = range.Min.HasValue ? (double)range.Min : 0;
                    max = range.Max.HasValue ? (double)range.Max : 100000;
                    ChartHelper.AddAPie(PieSeries, range.Title,
                                        new ChartValues <int> {
                        allActPlaces.Count(m => Convert.ToInt32(m.courtyard_area) >= min && Convert.ToInt32(m.courtyard_area) < max)
                    },
                                        PiePointLabel);
                }
                break;

            default:
                break;
            }
        }