Example #1
0
        public void DiagrammERInit()
        {
            var qry2 = from o in MonthUseERList
                       select new
            {
                o.FactCost,
                o.DifferenceCost,
                o.ResourceName
            };
            double Total = qry2.Sum(n => n.FactCost);

            var qry3 = from o in MonthUseERList
                       where o.FactCost >= Total * Proc / 100
                       orderby o.IdEnergyResource
                       select new
            {
                o.FactCost,
                o.ResourceName
            };
            var qry4 = from o in MonthUseERList
                       where o.FactCost < Total * Proc / 100
                       select new
            {
                o.FactCost,
                o.ResourceName
            };
            double Total1 = qry4.Sum(n => n.FactCost);

            SeriesCollection1.Clear();
            foreach (var newY in qry3.ToList())
            {
                PieSeries ps10 = new PieSeries
                {
                    Title      = newY.ResourceName,
                    DataLabels = true,
                    FontSize   = 14,
                    FontWeight = FontWeights.Bold,
                    LabelPoint = point => string.Format("{0},\r\n {1:N0}", newY.ResourceName, point.Y),
                    Values     = new ChartValues <ObservableValue> {
                        new ObservableValue(newY.FactCost)
                    }
                };
                SeriesCollection1.Add(ps10);
            }
            PieSeries ps2 = new PieSeries
            {
                Title      = "Прочие",
                DataLabels = true,
                FontSize   = 14,
                FontWeight = FontWeights.Bold,
                LabelPoint = point => string.Format("{0},\r\n {1:N0}", "Прочие", point.Y),
                Values     = new ChartValues <ObservableValue> {
                    new ObservableValue(Total1)
                }
            };

            SeriesCollection1.Add(ps2);
        }
Example #2
0
        public void DiagrammInit()
        {
            var qry2 = from o in MonthUseList
                       select new
            {
                o.FactCost,
                o.DifferenceCost,
                o.ResourceName
            };
            double Total     = qry2.Sum(n => n.FactCost);
            double TotalDiff = qry2.Sum(n => Math.Abs(n.DifferenceCost));

            var qry3 = from o in MonthUseList
                       orderby o.FactCost descending
                       select new
            {
                o.FactCost,
                o.ResourceName
            };

            var qry5 = from o in MonthUseList
                       orderby o.DifferenceCost descending
                       select new
            {
                o.DifferenceCost,
                o.ResourceName
            };

            SeriesCollection.Clear();
            foreach (var newY in qry3.ToList())
            {
                PieSeries ps10 = new PieSeries
                {
                    Title      = newY.ResourceName,
                    DataLabels = true,
                    FontSize   = 10,
                    FontWeight = FontWeights.Bold,
                    LabelPoint = point => string.Format("{0},\r\n {1:N0}", newY.ResourceName, point.Y),
                    Values     = new ChartValues <ObservableValue> {
                        new ObservableValue(newY.FactCost)
                    }
                };
                SeriesCollection.Add(ps10);
            }

            SeriesCollection1.Clear();
            ColumnSeries ps1 = new ColumnSeries()
            {
                //LabelsPosition = BarLabelPosition.Parallel,
                //Fill = System.Windows.Media.Brushes.PowderBlue,
                DataLabels = true,
                FontSize   = 10,
                FontWeight = FontWeights.Bold,
                Values     = new ChartValues <ObservableValue>()
            };

            foreach (var newY in qry5.ToList())
            {
                ps1.Values.Add(new ObservableValue(newY.DifferenceCost));
            }
            SeriesCollection1.Add(ps1);

            Labels.Clear();
            foreach (var newX in qry5.ToList())
            {
                Labels.Add(newX.ResourceName.ToString());
            }
            ;

            //Labels = new ObservableCollection<string>(MonthUseList.Select(x => x.ResourceName));
            Formatter = val => val.ToString("N0");
        }
Example #3
0
        public void DiagrammInit()
        {
            //int Proc = 3;
            var qry2 = from o in MonthUseList
                       select new
            {
                o.Fact,
                o.Difference,
                o.IdCostCenter
            };
            double Total     = qry2.Sum(n => n.Fact);
            double TotalDiff = qry2.Sum(n => Math.Abs(n.Difference));

            var qry3 = from o in MonthUseList
                       where o.Fact >= Total * Proc / 100
                       orderby o.Fact descending
                       select new
            {
                o.Fact,
                o.IdCostCenter
            };
            var qry4 = from o in MonthUseList
                       where o.Fact < Total * Proc / 100
                       select new
            {
                o.Fact,
                o.IdCostCenter
            };
            double Total1 = qry4.Sum(n => n.Fact);

            SeriesCollection.Clear();
            foreach (var newY in qry3.ToList())
            {
                PieSeries ps10 = new PieSeries
                {
                    Title      = newY.IdCostCenter.ToString(),
                    DataLabels = true,
                    FontSize   = 10,
                    FontWeight = FontWeights.Bold,
                    LabelPoint = point => string.Format("ЦЗ-{0},\r\n {1:N0}", newY.IdCostCenter, point.Y),
                    Values     = new ChartValues <ObservableValue> {
                        new ObservableValue(newY.Fact)
                    }
                };
                SeriesCollection.Add(ps10);
            }
            PieSeries ps2 = new PieSeries
            {
                Title      = "Прочие",
                DataLabels = true,
                FontSize   = 10,
                FontWeight = FontWeights.Bold,
                LabelPoint = point => string.Format("{0},\r\n {1:N0}", "Прочие", point.Y),
                Values     = new ChartValues <ObservableValue> {
                    new ObservableValue(Total1)
                }
            };

            SeriesCollection.Add(ps2);

            var qry5 = from o in MonthUseList
                       where Math.Abs(o.Difference) >= TotalDiff * Proc / 100
                       orderby o.Difference descending
                       select new
            {
                o.Difference,
                o.IdCostCenter
            };
            var qry6 = from o in MonthUseList
                       where Math.Abs(o.Difference) < TotalDiff * Proc / 100
                       select new
            {
                o.Difference,
                o.IdCostCenter
            };
            double Total2 = qry6.Sum(n => n.Difference);

            SeriesCollection1.Clear();
            ColumnSeries ps1 = new ColumnSeries()
            {
                //LabelsPosition = BarLabelPosition.Parallel,
                //Fill = System.Windows.Media.Brushes.PowderBlue,
                DataLabels = true,
                LabelPoint = point => string.Format("{0:N0}", point.Y),
                FontSize   = 10,
                FontWeight = FontWeights.Bold,
                Values     = new ChartValues <ObservableValue>()
            };

            foreach (var newY in qry5.ToList())
            {
                ps1.Values.Add(new ObservableValue(newY.Difference));
            }
            ps1.Values.Add(new ObservableValue(Total2));
            SeriesCollection1.Add(ps1);

            Labels.Clear();
            foreach (var newX in qry5.ToList())
            {
                Labels.Add(newX.IdCostCenter.ToString());
            }
            ;
            Labels.Add("Прочие");
        }