public ActionResult PieChart() { var datacontext = new POS2Entities1(); ArrayList xvalue = new ArrayList(); ArrayList yvalue = new ArrayList(); var result = from c in datacontext.acc_transactions group c by new { date = c.date.Value.Month, } into g select new { date = g.Key.date, Total = g.Sum(t => t.amount) }; result.ToList().ForEach(rs => xvalue.Add(rs.date)); result.ToList().ForEach(rs => yvalue.Add(rs.Total)); new Chart(width: 350, height: 250, theme: ChartTheme.Blue) .AddLegend("Month", "amount") .AddTitle("Pie Chart") .AddSeries("Default", chartType: "Pie", xValue: xvalue, yValues: yvalue) .Write("bmp"); return(null); }
public ActionResult Funnel() { var datacontext = new POS2Entities1(); ArrayList xvalue = new ArrayList(); ArrayList yvalue = new ArrayList(); var result = from c in datacontext.acc_transactions select c; result.ToList().ForEach(rs => xvalue.Add(rs.date)); result.ToList().ForEach(rs => yvalue.Add(rs.amount)); new Chart(width: 600, height: 400, theme: ChartTheme.Green) .AddTitle("Funnel Chart") .AddSeries("Default", chartType: "Funnel", xValue: xvalue, yValues: yvalue) .Write("bmp"); return(null); }
public ActionResult LineChart() { var datacontext = new POS2Entities1(); ArrayList xvalue = new ArrayList(); ArrayList yvalue = new ArrayList(); var result = (from c in datacontext.acc_transactions orderby c.date select new { date = c.date.Value.Month, amount = c.amount }); result.ToList().ForEach(rs => xvalue.Add(rs.date)); result.ToList().ForEach(rs => yvalue.Add(rs.amount)); new Chart(width: 1050, height: 250, theme: ChartTheme.Green) .AddTitle("Line Chart") .AddSeries("Default", chartType: "Line", xValue: xvalue, yValues: yvalue) .SetXAxis("Month") .SetYAxis("Amount") .Write("bmp"); return(null); }