public IActionResult Index() { ViewBag.SuccessBody = ApiCalls.GetDestinationFlights(); var flightsOrigins = ApiCalls.GetDestinationOrigins(); List <string> dests = new List <string>(); List <List <double?> > counts = new List <List <double?> >(); List <string> origins = new List <string>(); foreach (var flightsOrigin in flightsOrigins) { if (!origins.Contains(flightsOrigin.Origin)) { origins.Add(flightsOrigin.Origin); } List <double?> countList = new List <double?>(); foreach (var flight in flightsOrigin.Flights) { countList.Add(flight.count); } counts.Add(countList); foreach (var flight in flightsOrigin.Flights) { if (!dests.Contains(flight.Destination)) { dests.Add(flight.Destination); } } } Chart chart1 = BarCharts.BuildColorfulBarChartWithManyDatasets(dests, counts, origins); ViewData["chart1"] = chart1; return(View()); }
public virtual JsonResult _ContractStaticData() { var listModel = new List <BarCharts>(); for (int i = DateTime.Now.Year - 8; i <= DateTime.Now.Year; i++) { ///lay thong tin tong gia tri hop dong var _totalMoneyByYear = _contractService.GetTotalMoney(i); ///lay thong tin NTKL var _totalMoneyAcceptanceByYear = _contractService.GetTotalMoneyAcceptance(i); BarCharts model = new BarCharts(); model.AxisLabel = i.ToString(); model.Val1 = _totalMoneyByYear; model.Val2 = _totalMoneyAcceptanceByYear; listModel.Add(model); } return(Json(listModel)); }
public IActionResult Index() { //Create First Chart var monthlyFlights = ApiCalls.GetMonthlyFlights(); var monthsNames = GetMonthsNames(monthlyFlights); var counts = GetFlightsCounts(monthlyFlights); var chart1 = BarCharts.BuildColorfulBarChart(monthsNames, counts); //Craete Second Chart var monthlyFlightsOrigins = ApiCalls.GetMonthlyFlightsOrigin(); var countsByOrigin = GetFlightsCountsByOrigin(monthlyFlightsOrigins, out var origins); var chart2 = BarCharts.BuildColorfulBarChartWithManyDatasets(monthsNames, countsByOrigin, origins); var chart3 = BarCharts.GetStackedBarChart(monthsNames, countsByOrigin, origins); var countsByMonth = GetCountsByMonth(countsByOrigin); var sortedCountedByMonth = countsByMonth .SelectMany(inner => inner.Select((item, index) => new { item, index })) .GroupBy(i => i.index, i => i.item) .Select(g => g.ToList()) .ToList(); var chart4 = BarCharts.GetStackedBarChart(monthsNames, sortedCountedByMonth, origins); ViewData["chart1"] = chart1; ViewData["chart2"] = chart2; ViewData["chart3"] = chart3; ViewData["chart4"] = chart4; return(View()); }
public ContractModel() { SelectedContractFormIds = new List <int>(); AvailableContractForm = new List <SelectListItem>(); SelectedContractTypeIds = new List <int>(); AvailableContractType = new List <SelectListItem>(); SelectedContractPeriodIds = new List <int>(); SelectedPeriodIds = new List <int>(); AvailableContractPeriod = new List <SelectListItem>(); contractlogModels = new List <ContractLogModel>(); contractFormModels = new List <ContractFormModel>(); contractTypeModels = new List <ContractTypeModel>(); contractPeriodModels = new List <ContractPeriodModel>(); LstContractPayments = new List <ContractPaymentModel>(); contractResourceModels = new List <ContractResourceModel>(); contractRelateModels = new List <ContractModel>(); contractAppendixModels = new List <ContractModel>(); lstContractPaymentPlan = new List <ContractPaymentPlanModel>(); lstContractPaymentAcceptance = new List <ContractPaymentAcceptanceModel>(); contractpaymentRequestModels = new List <ContractPaymentRequestModel>(); lstContractAcceptance = new List <ContractAcceptanceModel>(); lstContractAcceptanceNoiBo = new List <ContractAcceptanceModel>(); lstTask = new List <TaskModel>(); AvailableTask = new List <SelectListItem>(); DisplayType = ContractDisplayType.Row; contractMonitor = new ContractMonitorModel(); BarCharts barCharts = new BarCharts(); lsContractSettlement = new List <ContractSettlementModel>(); LstTaskModel = new List <TaskModel>(); LstTaskModelChuaThucHien = new List <TaskModel>(); LstTaskModelDangThucHien = new List <TaskModel>(); lstContractAcceptanceSub = new List <ContractAcceptanceSubModel>(); lstContractUnfinishModel = new List <ContractUnfinishModel>(); lstContractUnfinish2Model = new List <ContractUnfinishModel>(); lstContractUnfinishModel2 = new List <ContractUnfinishModel>(); }