public PieChartView() { InitializeComponent(); _viewModel = new PieChartViewModel(); DataContext = _viewModel; }
void MainPage_Loaded(object sender, RoutedEventArgs e) { PieChartViewModel data = new PieChartViewModel(); this.DataContext = data; data.Load(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { viewModel = new PieChartViewModel(); viewModel.Errors.Add(new TestClass() { Category = "Globalization", Number = 75 }); viewModel.Errors.Add(new TestClass() { Category = "Features", Number = 2 }); viewModel.Errors.Add(new TestClass() { Category = "ContentTypes", Number = 12 }); viewModel.Errors.Add(new TestClass() { Category = "Correctness", Number = 83 }); viewModel.Errors.Add(new TestClass() { Category = "Best Practices", Number = 29 }); DataContext = viewModel; }
public GachaAnalysisView(UserData userData) { InitializeComponent(); _UserData = userData; ToggleButton_HiddenNoviceWish.IsChecked = userData.HiddenNoviceWish; _PieChartViewModels = new ObservableCollection <PieChartViewModel>(); ItemsControl_PieChartView.DataContext = this; var wishList = LocalWishLogLoader.Load(userData.WishLogFile); var analyzer = new PieChartAnalyzer(wishList); PieChartViewModels.Clear(); if (analyzer.CharacterEventStatistics.Count > 0) { PieChartViewModels.Add(new PieChartViewModel(analyzer.CharacterEventStatistics)); } if (analyzer.WeaponEventStatistics.Count > 0) { PieChartViewModels.Add(new PieChartViewModel(analyzer.WeaponEventStatistics)); } if (analyzer.PermanentStatistics.Count > 0) { PieChartViewModels.Add(new PieChartViewModel(analyzer.PermanentStatistics)); } if (analyzer.NoviceStatistics.Count > 0) { _NovicePieChart = new PieChartViewModel(analyzer.NoviceStatistics); if (!_UserData.HiddenNoviceWish) { PieChartViewModels.Add(_NovicePieChart); } } }
// GET: Chart public JsonResult GetTicketPriorityPieChatData() { var pieChartViewModel = new PieChartViewModel(); var priorities = db.TicketPriorities.ToList(); var ticket = db.Tickets.ToList(); foreach (var priority in priorities) { pieChartViewModel.Lables.Add(priority.Name); pieChartViewModel.BackgroundColor.Add(priority.Color); var ticketPriorityCount = ticket.Where(tp => tp.TicketPriorityId == priority.Id).ToList().Count; pieChartViewModel.Data.Add(ticketPriorityCount); } return(Json(pieChartViewModel)); }
private PieChartViewModel GetPieChart2() { PieDataSet dataset = new PieDataSet() { data = new int[] { 300, 150, 40 }, backgroundColor = new string[] { "#FF6384", "#36A2EB", "#FFCE56" }, hoverBackgroundColor = new string[] { "#FF6384", "#36A2EB", "#FFCE56" } }; PieChartViewModel vm = new PieChartViewModel() { labels = new string[] { "D", "E", "F" }, datasets = new PieDataSet[] { dataset } }; return(vm); }
public List <PieChartViewModel> InitPieChart(string empid) { var storeProcedureName = "[dbo].[Init_PieChart]"; var result = _dbContext.Database.SqlQuery <PieChartViewModel>( $"{storeProcedureName} @empid", new SqlParameter("@empid", empid) ).ToList(); var list = new List <PieChartViewModel>(); foreach (var i in result) { var ord = new PieChartViewModel(); ord.ProductName = i.ProductName; ord.Count = i.Count; list.Add(ord); } return(list); }
private void LoadTransactions(SupportedTransactionTypes transactionsType) { var transactionsFilePath = GetTransactionsFilePath(); if (string.IsNullOrWhiteSpace(transactionsFilePath)) { return; } var transactions = _transactionsManager.CreateTransactionsFromFile(transactionsFilePath, transactionsType); var observableTransactions = new ObservableCollection <ITransaction>(transactions); Transactions = observableTransactions; LineGraphViewModel = new LineGraphViewModel(Transactions); QuickInfoPageViewModel = new QuickInfoPageViewModel(Transactions); TransactionsListViewModel = new TransactionsListViewModel(Transactions); PieChartViewModel = new PieChartViewModel(Transactions); }
public JsonResult ServerPieChartsData() { List <PieChartSerieDataViewModel> seriesDatas = new List <PieChartSerieDataViewModel>(); for (int i = 0; i < 5; i++) { decimal d = 5 * i; PieChartSerieDataViewModel pieChartSerieDataViewModel = new PieChartSerieDataViewModel(); pieChartSerieDataViewModel.DataName = "Tokyo : " + i; pieChartSerieDataViewModel.DataY = d; seriesDatas.Add(pieChartSerieDataViewModel); } var model = new PieChartViewModel(); model.TitleText = "Browser market shares at a specific website, 2010"; model.SeriesDatas = seriesDatas.ToArray(); return(Json(model, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Initializes a new instance of the <see cref="PieChartExample"/> class. /// </summary> public PieChartExample() { InitializeComponent(); vm = new PieChartViewModel(); this.BindingContext = vm; }
public NumDistribution() { vm = new PieChartViewModel(); InitializeComponent(); this.BindingContext = vm; }
//private void TapGestureRecognizer_Tapped_1(object sender, EventArgs e) //{ // Navigation.PushAsync(new TestListView()); //} protected override async void OnAppearing() { //WHERE Tests =\"" + tableName + "\" testScore = await dbConn.QueryAsync <TestScore>("Select Tests,TestName,Numbertapped,SectionA,SectionB,SectionC,SectionD,OutOF,OutofC,OutofB,OutofD,Email From [Test_score]"); // listViewItems = await dbConn.QueryAsync<TestScore>("Select Tests,Score,Numbertapped From [Test_score]"); testDetails = await dbConn.QueryAsync <TestDetail>("Select TestName,SectionAs,SectionBs,SectionCs,SectionDs,AverageScore," + "AverageTime,ScoreA,ScoreB,ScoreC,ScoreD,Atotal," + "Btotal,Ctotal,Dtotal,Attempts From [TestDetail]"); //dbConn.GetConnection().Close(); //await DisplayAlert("", ""+testDetails.Count, "OK"); //if (testDetails.Count > 0) //{ // await DisplayAlert("alert", "Average Time: "+testDetails[testDetails.Count-1].AverageTime +" SCORE:"+ testDetails[testDetails.Count - 1] // .Atotal+ testDetails[testDetails.Count - 1].Btotal+ testDetails[testDetails.Count - 1].Ctotal, "ok"); //} // this.Content=new ScrollView { this.sl ,Or} string testCatagory = testScore[1].Email; dashBoardListview = await dbConn.QueryAsync <DashBoardListview>("Select TestName,AScore,BScore,CScore,AverageScore,Attempts,A,B,C,TimeTaken From [DashBoardListview] where TestCatagory=\"" + testCatagory + "\""); TestNoOfTapped.Text = testScore[1].Email; //Mylistt.ItemsSource = testScore; //int min = list.Count; if (testDetails.Count == 0) { vm = new PieChartViewModel("000", 00, 1, 0); testresult.Text = "Result of (" + dashBoardListview.Count + ") Tests Attempted " + testDetails.Count + " Times"; //vm = new PieChartViewModel(testScore[0].TestName, testScore[0].Numbertapped, 1, 0); // Mylistt.ItemsSource = null; // ScoreList.ItemsSource = dashBoardListview; } else { List <int> Av = new List <int>(); List <int> To = new List <int>(); List <int> Aaverage = new List <int>(); List <int> Baverage = new List <int>(); List <int> Caverage = new List <int>(); List <int> Daverage = new List <int>(); List <int> Atot = new List <int>(); List <int> Btot = new List <int>(); List <int> Ctot = new List <int>(); List <int> Dtot = new List <int>(); int a = 0; int b = 0; int c = 0; int d = 0; int AverageScore = 0; int Total = 0; int Aave = 0; int Bave = 0; int Cave = 0; int Dave = 0; for (int i = 0; i < testDetails.Count; i++) { AverageScore = testDetails[i].Atotal + testDetails[i].Btotal + testDetails[i].Ctotal + testDetails[i].Dtotal; Av.Add(AverageScore); Total = testDetails[i].ScoreA + testDetails[i].ScoreB + testDetails[i].ScoreC + testDetails[i].ScoreD; To.Add(Total); Aave = testDetails[i].ScoreA; Aaverage.Add(Aave); Bave = testDetails[i].ScoreB; Baverage.Add(Bave); Cave = testDetails[i].ScoreC; Caverage.Add(Cave); Dave = testDetails[i].ScoreD; Daverage.Add(Dave); AverageScore += AverageScore; Total += Total; a = testDetails[i].Atotal; Atot.Add(a); b = testDetails[i].Btotal; Btot.Add(b); c = testDetails[i].Ctotal; Ctot.Add(c); d = testDetails[i].Dtotal; Dtot.Add(d); } int add = To.Select(i => i).Sum(); int aa = Aaverage.Select(i => i).Sum(); int bb = Baverage.Select(i => i).Sum(); int cc = Caverage.Select(i => i).Sum(); int dd = Daverage.Select(i => i).Sum(); int add2 = Av.Select(i => i).Sum(); int aoutof = Atot.Select(i => i).Sum(); int boutof = Btot.Select(i => i).Sum(); int coutof = Ctot.Select(i => i).Sum(); int doutof = Dtot.Select(i => i).Sum(); // await DisplayAlert("al", "" + add + "/" + add2, "ok"); //int testAscore = testDetails[0].OutofC; //int testBscore = testScore[1].OutofC; //int testCscore = testScore[2].OutofC; // int Atotal = testScore[0].OutofB; // int Btotal = testScore[1].OutofB; // int Ctotal = testScore[2].OutofB; // int total = testAscore + testBscore + testCscore; // int AverageScore = Atotal + Btotal + Ctotal; if (add2 == 0) { //int rightper = (total * 100 / AverageScore); //int wrongper = 100 - rightper; // await DisplayAlert("task", "tablename" + tableName + " right: " + rightper + " wrong: " +OutOf, "ok"); vm = new PieChartViewModel(testScore[0].TestName, testScore[0].Numbertapped, 1, 0); testresult.Text = "Result of (" + dashBoardListview.Count + ") Tests Attempted " + testDetails.Count + " Times"; // ScoreList.ItemsSource = dashBoardListview; } else { testresult.Text = "Result of (" + dashBoardListview.Count + ") Tests Attempted " + testDetails.Count + " Times"; int rightper = (add * 100 / add2); int wrongper = 100 - rightper; // await DisplayAlert("task", "tablename" + tableName + " right: " + rightper + " wrong: " +OutOf, "ok"); vm = new PieChartViewModel(testScore[0].TestName, testScore[0].Numbertapped, wrongper, rightper); SectionA.Text = aa + "/" + aoutof; SectionB.Text = bb + "/" + boutof; SectionC.Text = cc + "/" + coutof; SectionD.Text = dd + "/" + doutof; int aper = (aa * 100 / aoutof); int bper = (bb * 100 / boutof); int cper = (cc * 100 / coutof); int dper = (dd * 100 / doutof); SectionAPer.Text = aper + "%"; SectionBPer.Text = bper + "%"; SectionDPer.Text = dper + "%"; SectionCPer.Text = cper + "%"; double avrg = To.Select(i => i).Sum(); double devid = Av.Select(i => i).Sum(); double avrageScore = avrg / devid; Average.Text = string.Format("{0:F2}", avrageScore); TotalPer.Text = rightper + "%"; //await DisplayAlert("ok", "avrg"+avrg+" devid:"+devid, "ok"); //SectionCPer.Text = cper + "%"; // ScoreList.ItemsSource = dashBoardListview; } // //int OutOf = testScore[0].OutOF; // //Mylistt.ItemsSource = null; // ScoreList.ItemsSource = testScore; } this.BindingContext = vm; //Mylistt.ItemsSource = LIST; base.OnAppearing(); }
public List <PieChartViewModel> GetPieChartData(ReportFilterViewModel obj) { string[] BatchRangeArray = new string[obj.BatchRangeArray.Length]; int[] BatchIds = null; for (int i = 0; i < obj.BatchRangeArray.Length; i++) { BatchRangeArray[i] = "Batch " + obj.BatchRangeArray[i]; } var info = _context.tblPerformanceEntryMasters.Include("AddmissionMaster").Include("AddmissionMaster.AddmissionDetail").Where(w => w.ReviewId != 1 && w.tblPerformanceParameterTypeResultMasters.Count() > 0 && !w.tblPerformanceParameterTypeResultMasters.FirstOrDefault().tblPerformanceParameterResultMasters.FirstOrDefault().IsNotApplicable).AsQueryable(); if (obj.ReviewId > 0) { info = _context.tblPerformanceEntryMasters.Where(w => w.ReviewId == obj.ReviewId); } if (BatchRangeArray.Length > 0) { BatchIds = GetBatchArrIds(BatchRangeArray); } var data = info.Select(item => new PerformanceEntryMasterViewModel { AdmBatchId = item.AddmissionMaster.AddmissionDetails.FirstOrDefault().BatchId, BatchId = item.BatchId, AddmissionMasterId = item.AddmissionMasterId, EnteredBy = item.EnteredBy, EnteredDate = item.EnteredDate, Id = item.Id, Percentage = item.Percentage, RegistrationNo = item.RegistrationNo, ReviewId = item.ReviewId, tblPerformanceMasterId = item.tblPerformanceMasterId, tblWeeklyReviewMasterId = item.tblWeeklyReviewMasterId, PerformanceReview = item.PerformanceReview, tblWeeklyReviewMaster = item.tblWeeklyReviewMaster }).Where(w => BatchIds.Contains(w.BatchId.Value) && w.AdmBatchId == w.BatchId).ToList(); List <PieChartViewModel> Model = new List <PieChartViewModel>(); decimal Number = data.Count(); int HighStudent = 0; int MidStudent = 0; int LowStudent = 0; PieChartViewModel m1 = new PieChartViewModel(); PieChartViewModel m2 = new PieChartViewModel(); PieChartViewModel m3 = new PieChartViewModel(); m1.Type = "HighPerformers"; m2.Type = "MidPerformers"; m3.Type = "HighPerformers"; if (Number > 0) { PerformanceService performanceService = new PerformanceService(); foreach (var item in data) { if (!string.IsNullOrEmpty(item.Percentage)) { var percentage = performanceService.GetPercentageCritiria(item.BatchId.Value, item.ReviewId); decimal d = Convert.ToDecimal(item.Percentage.Split(' ')[0]); if (d >= Convert.ToDecimal(percentage[2].FromPercentage)) { HighStudent = HighStudent + 1; } else if (d < Convert.ToDecimal(percentage[2].FromPercentage) && d >= Convert.ToDecimal(percentage[1].FromPercentage)) { MidStudent = MidStudent + 1; } else { LowStudent = LowStudent + 1; } } } if (HighStudent > 0) { m1.NoOfStudent = HighStudent; m1.Percentage = Math.Round((HighStudent * 100) / (Number), 2); } if (MidStudent > 0) { m2.NoOfStudent = MidStudent; m2.Percentage = Math.Round((MidStudent * 100) / (Number), 2); } if (LowStudent > 0) { m3.NoOfStudent = LowStudent; m3.Percentage = Math.Round((LowStudent * 100) / (Number), 2); } } Model.Add(m1); Model.Add(m2); Model.Add(m3); return(Model); }
public PieChart(IProvideExpenditureDataProvider provider) { InitializeComponent(); DataContext = new PieChartViewModel(provider); }