public static PieChartObjectModel MapChartObjectToChartObjectModel(this PieChartObject chartObject) { if (chartObject == null) { return(null); } return(new PieChartObjectModel { Name = chartObject.Name, Y = chartObject.Y }); }
public ActionResult GetPieChartData() { ApplicationDbContext db = new ApplicationDbContext(); PieChartObject billable = new PieChartObject(); billable.color = "rgba(0, 168, 0, 0.6)"; //billable.highlight = "rgba(0, 168, 0, 0.6)"; billable.label = "Billable"; IQueryable <WorkResponse> billables = from w in db.WorkResponses where w.Billable select w; foreach (WorkResponse wr in billables) { billable.value += Convert.ToInt32(wr.TimeWorked.TotalHours); } PieChartObject nonbillable = new PieChartObject(); nonbillable.color = "rgba(255, 0, 0, 0.6)"; //nonbillable.highlight = "rgba(255, 0, 0, 0.6)"; nonbillable.label = "NonBillable"; IQueryable <WorkResponse> nonbillables = from w in db.WorkResponses where !w.Billable select w; foreach (WorkResponse wr in nonbillables) { nonbillable.value += Convert.ToInt32(wr.TimeWorked.TotalHours); } List <PieChartObject> pieChart = new List <PieChartObject>() { billable, nonbillable }; JsonResult jr = Json(pieChart.ToArray(), JsonRequestBehavior.AllowGet); string jsondata = JsonConvert.SerializeObject(jr); return(jr); }
public void Export() { PieChartObject.Export(); }
public string Create() { string reportPart = PieChartObject.Create(); return(reportPart); }