예제 #1
0
        void CreateChart()
        {
            dayValues.Children.Clear();
            List<int> barValues = new List<int>();

            foreach (var item in weeklyEducasStatistics)
            {
                barValues.Add(item.Total);
            }

            LineBarLayout newBar = new LineBarLayout(0, 0, weekDayCalendar.Width, weekDayCalendar.Height);
            newBar.upChartValuesList(barValues);
            newBar.getMaxValue();
            newBar.createGraph();

            LineDiagram diagram = new LineDiagram(newBar.DiagramPoints, getDayOftheWeekInteger(DateTime.Now));
            diagram.Stroke = GetColor("#d1dbbd");
            diagram.StrokeThickness = 2;
            newBar.Opacity = 0;
            weekDayCalendar.Children.Add(newBar);

            weekDayCalendar.Children.Add(diagram);

            for (int i = 0; i < newBar.WeeklyBarChartProperty.Count; i++)
            {
                if (i == getDayOftheWeekInteger(DateTime.Now))
                {
                    Label dayContent = new Label();
                    dayContent.Content = newBar.WeeklyBarChartProperty[i].valueContent;
                    dayContent.HorizontalAlignment = HorizontalAlignment.Center;
                    dayContent.VerticalAlignment = VerticalAlignment.Center;
                    dayContent.VerticalContentAlignment = VerticalAlignment.Center;
                    dayContent.Margin = new System.Windows.Thickness(2.0);
                    dayContent.Style = App.Current.Resources["EducationUI_NumbersInWeek"] as Style;
                    ColumnDefinition colDef = new ColumnDefinition();
                    dayValues.Children.Add(dayContent);
                    dayValues.ColumnDefinitions.Add(colDef);
                    colDef.Width = new GridLength(dayValues.Width / 7);
                    Grid.SetRow(dayContent, 0);
                    Grid.SetColumn(dayContent, i);
                    break;
                }
                else
                {
                    Label dayContent = new Label();
                    dayContent.Content = newBar.WeeklyBarChartProperty[i].valueContent;
                    dayContent.HorizontalAlignment = HorizontalAlignment.Center;
                    dayContent.VerticalAlignment = VerticalAlignment.Center;
                    dayContent.VerticalContentAlignment = VerticalAlignment.Center;
                    dayContent.Margin = new System.Windows.Thickness(2.0);
                    dayContent.Style = App.Current.Resources["EducationUI_NumbersInWeek"] as Style;
                    ColumnDefinition colDef = new ColumnDefinition();
                    dayValues.Children.Add(dayContent);
                    dayValues.ColumnDefinitions.Add(colDef);
                    colDef.Width = new GridLength(dayValues.Width / 7);
                    Grid.SetRow(dayContent, 0);
                    Grid.SetColumn(dayContent, i);
                }
            }
        }
예제 #2
0
        void CreateChart()
        {
            weekDayCalendar.Children.Clear();
            List<int> barValues = new List<int>();
            newBar = new LineBarLayout(0, 0, weekDayCalendar.Width, weekDayCalendar.Height);
            //newBar.getMaxValue();
            newBar.EstimatedMaxValue = Controller.getThisYearThisMonthSalesBudget();



            foreach (var item in currSales)
            {
                barValues.Add(item.Total);
                //totalLogic;
            }

            newBar.upChartValuesList(barValues);
            newBar.createGraph2();

            LineDiagram diagram = new LineDiagram(newBar.DiagramPoints, DateTime.Now.Day - 2);
            LineDiagram estimatedDiagram = new LineDiagram(newBar.ReturnSmallestAndEstimatedDiagram(), 1);

            diagram.Stroke = GetColor("#ffffff");
            diagram.StrokeThickness = 2;

            estimatedDiagram.Stroke = GetColor("#6a95a3");
            estimatedDiagram.StrokeThickness = 2;

            newBar.Opacity = 0;
            weekDayCalendar.Children.Add(newBar);
            weekDayCalendar.Children.Add(estimatedDiagram);
            weekDayCalendar.Children.Add(diagram);

            double thisYearthisMonthPercent = ((double)newBar.ActualTotal / (double)newBar.EstimatedMaxValue * 100);
            if (thisYearthisMonthPercent.ToString() == "NaN")
            {
                lbSalesNOWValue.Content = "0 %";
            }else
	        {
                lbSalesNOWValue.Content = Math.Round(Convert.ToDecimal(thisYearthisMonthPercent)) + "%";
	        }
        }