Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我正在使用Chart.js并试图列出过去7天的出席人数 列表重新分区=新建列表(); var membs=students.Select(p=>p.MembershipID).Distinct(); var attent=students.Select(p=>p.attentations.Select(o=>o.attentdanceid.Distinct()); DateTime[]Last7days=Enumerable.Range(0,7)。选择(i=>DateTime.Now.AddDays(-i)).ToArray(); foreach(最近7天内的var日){ foreach(出席中的var项目){ 添加(students.Count(x=>x.attentations.Any().Equals(item)); //Add(students.Count(x=>x.MembershipID==item)); } }_Javascript_Asp.net Mvc_Chart.js - Fatal编程技术网

Javascript 我正在使用Chart.js并试图列出过去7天的出席人数 列表重新分区=新建列表(); var membs=students.Select(p=>p.MembershipID).Distinct(); var attent=students.Select(p=>p.attentations.Select(o=>o.attentdanceid.Distinct()); DateTime[]Last7days=Enumerable.Range(0,7)。选择(i=>DateTime.Now.AddDays(-i)).ToArray(); foreach(最近7天内的var日){ foreach(出席中的var项目){ 添加(students.Count(x=>x.attentations.Any().Equals(item)); //Add(students.Count(x=>x.MembershipID==item)); } }

Javascript 我正在使用Chart.js并试图列出过去7天的出席人数 列表重新分区=新建列表(); var membs=students.Select(p=>p.MembershipID).Distinct(); var attent=students.Select(p=>p.attentations.Select(o=>o.attentdanceid.Distinct()); DateTime[]Last7days=Enumerable.Range(0,7)。选择(i=>DateTime.Now.AddDays(-i)).ToArray(); foreach(最近7天内的var日){ foreach(出席中的var项目){ 添加(students.Count(x=>x.attentations.Any().Equals(item)); //Add(students.Count(x=>x.MembershipID==item)); } },javascript,asp.net-mvc,chart.js,Javascript,Asp.net Mvc,Chart.js,我试图显示一个学生在过去7天内参加的次数,但我得到以下例外 无法比较“System.Collections.Generic.IEnumerable”类型的元素1[[System.Int32, 您可能正在将Int值与某种对象进行比较。您的项变量仅包含AttendanceID,您正在将此值与学生对象进行比较 你可能需要像这样改变你的状况 List<int> repartitions = new List<int>(); var membs = students.Select(

我试图显示一个学生在过去7天内参加的次数,但我得到以下例外

无法比较“System.Collections.Generic.IEnumerable”类型的元素
1[[System.Int32,


您可能正在将Int值与某种对象进行比较。您的
变量仅包含
AttendanceID
,您正在将此值与
学生
对象进行比较

你可能需要像这样改变你的状况

List<int> repartitions = new List<int>();
var membs = students.Select(p => p.MembershipID).Distinct();
var attend = students.Select(p => p.Attendances.Select(o => o.AttendanceID).Distinct());

DateTime[] Last7days = Enumerable.Range(0, 7).Select(i => DateTime.Now.AddDays(-i)).ToArray();
foreach (var day in Last7days) {
  foreach (var item in attend) {
    repartitions.Add(students.Count(x=>x.Attendances.Any().Equals(item)));
    //repartitions.Add(students.Count(x => x.MembershipID == item));
  }
}

您可能正在将Int值与某种对象进行比较。您的
变量仅包含
AttendanceID
,您正在将此值与
学生
对象进行比较

你可能需要像这样改变你的状况

List<int> repartitions = new List<int>();
var membs = students.Select(p => p.MembershipID).Distinct();
var attend = students.Select(p => p.Attendances.Select(o => o.AttendanceID).Distinct());

DateTime[] Last7days = Enumerable.Range(0, 7).Select(i => DateTime.Now.AddDays(-i)).ToArray();
foreach (var day in Last7days) {
  foreach (var item in attend) {
    repartitions.Add(students.Count(x=>x.Attendances.Any().Equals(item)));
    //repartitions.Add(students.Count(x => x.MembershipID == item));
  }
}

我以前尝试过此操作,但出现以下错误
无法将Ennumberable隐式转换为bool
我以前尝试过此操作,但出现以下错误
无法将Ennumberable隐式转换为bool