-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewCount.cshtml
102 lines (95 loc) · 2.67 KB
/
NewCount.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@{
Layout = "~/_xuejiLayout.cshtml";
var id = Request["classes_id"];
var db = Database.Open("ctXueji");
int normal = 0;
int tardy = 0;
int cut = 0;
var name = db.QuerySingle("select * from View_classes_one where id=" + id);
//var coursesArranging = "select * from coursesArranging";
var classes = "select * from rollcall where classes_id=" + id;
foreach (var row in db.Query(classes))
{
Dictionary<int, int> str = new Dictionary<int, int>();
str = Functions.StringToDictionary(row.sid_state);
foreach (var i in str)
{
switch (i.Value)
{
case 1:
normal++;
break;
case 2:
cut++;
break;
case 5:
cut++;
break;
case 4:
tardy++;
break;
default:
cut++;
break;
}
}
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="~/Scripts/highcharts.js"></script>
<script src="~/Scripts/exporting.js"></script>
<script src="~/Scripts/export-data.js"></script>
</head>
<body>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<script>
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: '@name.classes_year@name.majors_name'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: '正常出勤',
y: @normal,
sliced: true,
selected: true
}, {
name: '旷课',
y: @cut
}, {
name: '迟到',
y: @tardy
}]
}]
});
</script>
</body>
</html>