-1
你好基本上我想要一个下拉列表来显示员工姓名列表,当管理员或管理人员正在使用它时选择图表必须显示的名称。这可能吗?如果有,请帮我...我如何获得一个下拉列表,当选择一个值来显示mvc中使用mvc图表助手的图表中的员工值时?
public ActionResult CharterColumn()
{
var results = (from c in db.Clockcards select c);
// the employeeid is a foreign key in the clockcards table
// i want to get the name from the employee table
// and display only that employees hours worked for the months
var groupedByMonth = results
.OrderByDescending(x => x.CaptureDate)
.GroupBy(x => new { x.CaptureDate.Year, x.CaptureDate.Month }).ToList();
List<string> monthNames = groupedByMonth
.Select(a => a.FirstOrDefault().CaptureDate.ToString("MMMM"))
.ToList();
List<double> hoursPerMonth = groupedByMonth
.Select(a => a.Sum(p => p.Hours))
.ToList();
ArrayList xValue = new ArrayList(monthNames);
ArrayList yValue = new ArrayList(hoursPerMonth);
new Chart(width: 800, height: 400, theme: ChartTheme.Yellow)
.AddTitle("Chart")
.AddSeries("Default", chartType: "Column", xValue: xValue, yValues: yValue)
.Write("bmp");
return null;
}
这是我的看法
<div>
<img src= "@Url.Action("CharterColumn")" alt="Chart"/>
</div>
您的代码中没有关于下拉列表的任何内容! –
我在问是否可以用mvc图表做这个,如果有的话我该怎么做 – Kimberly