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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "Server CPU Utilization Vs Active Users"
},
axisX: {
title: "Active Users"
},
axisY: {
title: "CPU Utilization",
suffix: "%"
},
legend: {
cursor: "pointer",
itemclick: toggleDataSeries
},
data: [{
type: "scatter",
name: "Server 1",
showInLegend: true,
toolTipContent: "<span style='color:#4F81BC '>{name}</span><br>Active Users: {x}<br>CPU Utilization: {y}%",
dataPoints: [
{ x: 100, y: 10 },
{ x: 110, y: 15 },
{ x: 130, y: 17 },
{ x: 140, y: 19 },
{ x: 145, y: 21 },
{ x: 400, y: 25 },
{ x: 430, y: 27 },
{ x: 444, y: 30 },
{ x: 460, y: 29 },
{ x: 490, y: 35 },
{ x: 500, y: 40 },
{ x: 510, y: 50 },
{ x: 600, y: 30 },
{ x: 700, y: 35 },
{ x: 800, y: 40 },
{ x: 900, y: 45 },
{ x: 1000, y: 47 },
{ x: 1200, y: 55 },
{ x: 1230, y: 51 },
{ x: 1300, y: 60 },
{ x: 1330, y: 65 },
{ x: 1400, y: 70 },
{ x: 1450, y: 71 },
{ x: 1500, y: 69 },
{ x: 1530, y: 75 },
{ x: 1590, y: 79 },
{ x: 1600, y: 62 },
{ x: 1620, y: 80 },
{ x: 1640, y: 85 },
{ x: 1700, y: 81 },
{ x: 1790, y: 89 },
{ x: 1800, y: 91 },
{ x: 1950, y: 93 },
{ x: 1980, y: 88 },
{ x: 2000, y: 90 }
]
},
{
type: "scatter",
name: "Server 2",
showInLegend: true,
markerType: "triangle",
toolTipContent: "<span style='color:#C0504E '>{name}</span><br>Active Users: {x}<br>CPU Utilization: {y}%",
dataPoints: [
{ x: 100, y: 25 },
{ x: 110, y: 35 },
{ x: 130, y: 35 },
{ x: 140, y: 40 },
{ x: 145, y: 45 },
{ x: 400, y: 42 },
{ x: 430, y: 32 },
{ x: 444, y: 35 },
{ x: 460, y: 43 },
{ x: 490, y: 50 },
{ x: 500, y: 57 },
{ x: 510, y: 67 },
{ x: 600, y: 40 },
{ x: 700, y: 46 },
{ x: 800, y: 50 },
{ x: 900, y: 60 },
{ x: 1000, y: 66 },
{ x: 1200, y: 79 },
{ x: 1230, y: 60 },
{ x: 1300, y: 75 },
{ x: 1330, y: 80 },
{ x: 1400, y: 82 },
{ x: 1450, y: 88 },
{ x: 1500, y: 87 },
{ x: 1530, y: 88 },
{ x: 1590, y: 90 },
{ x: 1600, y: 80 },
{ x: 1620, y: 93 },
{ x: 1640, y: 91 },
{ x: 1700, y: 92 },
{ x: 1790, y: 93 },
{ x: 1800, y: 90 },
{ x: 1950, y: 91 },
{ x: 1980, y: 93 },
{ x: 2000, y: 95 }
]
}]
});
chart.render();
function toggleDataSeries(e) {
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
} else {
e.dataSeries.visible = true;
}
e.chart.render();
}
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; max-width: 920px; margin: 0px auto;"></div>
<script src="../../asset/js/canvasjs/canvasjs.min.js"></script>
</body>
</html>