public JsonResult PriorityChart() { var result = new ChartJsModel(); var priorities = _context.TicketPriorities.ToList(); int count = 0; foreach (var priority in priorities) { result.Labels.Add(priority.Name); result.Data.Add(_context.Tickets.Where(t => t.TicketPriorityId == priority.Id).Count()); if (count < 10) { result.BackgroundColors.Add(_backgroundColors[count]); } else { result.BackgroundColors.Add(_backgroundColors[count % 10]); } count++; } return(Json(result)); }
public void Clear() { chartJsModel = new ChartJsModel(); }
public ChartJsBuilder() { this.chartJsModel = new ChartJsModel(); }