public ActionResult ChartPie() { var db = new GreetingDatabaseEntities(); var xValueArrayList = new ArrayList(); var yValueArrayList = new ArrayList(); var resultsPayments = db.Payments.Select(c => c); resultsPayments.ToList().ForEach(rs => xValueArrayList.Add(rs.Service.name)); resultsPayments.ToList().ForEach(rs => yValueArrayList.Add(rs.amount.ToString())); new Chart(width: 800, height: 600, theme: ChartTheme.Blue) .AddTitle("Desktop Amount In E Greeting Payment , Jul-2017") .AddSeries("Default", chartType: "Pie", xValue: xValueArrayList, xField: "Service", yValues: yValueArrayList, yFields: "Amount") .AddLegend(title: "Service", name: "Amount") .SetXAxis(title: "Service") .Write("bmp"); return(null); }