private UserTrackingChartOutPutVModel LoadUserTrackingData(IEnumerable <UserTrackingDto> userTrackingList, UserTrackingChartViewModel model) { //var userTrackingList = _userTrackingAppService.GetAllUserTrackingList(new PagedResultRequestExtDto() { UserId = model.UserId, FromDate = model.FromDate, ToDate = model.ToDate }).OrderBy(x => x.CreationTime); //var _chartHelper = new ChartHelper(_userTrackingAppService, _lookupAppService, _helper); var result = GetUserTrackingChartData(userTrackingList, model.UserTrackingBodyPart, model.MeasurementScaleLKDId); return(result); }
public IActionResult LoadChartViewComponent(UserTrackingChartViewModel model) { return(ViewComponent("UserTrackingChart", model)); }
public ChartJsVModel LoadChart(IEnumerable <UserTrackingDto> userTrackingList, UserTrackingChartViewModel model) { var resultList = LoadUserTrackingData(userTrackingList, model); var lebels = resultList.list.Select(x => x.date.ToShortDateString()); var data = resultList.list.Select(x => x.count); // var _chartHelper = new ChartHelper(_userTrackingAppService, _lookupAppService, _helper); var chartJsonString = LoadChartJsonString(); var chart = JsonConvert.DeserializeObject <ChartJs>(chartJsonString); if (!String.IsNullOrEmpty(model.ChartType)) { chart.type = model.ChartType; } chart.data.labels = lebels.ToList(); chart.data.datasets.First().data = data.ToList(); chart.data.datasets.First().label = resultList.scaleText; var chartModel = new ChartJsVModel { HtmlControlId = model.HtmlControlId, Chart = chart, ChartJson = JsonConvert.SerializeObject(chart, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }) }; return(chartModel); }