-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
119 lines (93 loc) · 2.62 KB
/
index.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<!-- 1. Add these JavaScript inclusions in the head of your page -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<!-- 2. Add the JavaScript to initialize the chart on document ready -->
<script type="text/javascript">
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Redis-Benchmark'
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'Requests'
}
},
series: [],
colors: ['#df4810', '#3d4c4e', '#45a797', "#45a797", "#fddd67", "#5fa727"]
};
var options_ledis = {
chart: {
renderTo: 'container_ledis',
type: 'column'
},
title: {
text: 'Ledis-Benchmark'
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'Requests'
}
},
series: [],
colors: ['#df4810', '#3d4c4e', '#45a797', "#45a797", "#fddd67", "#5fa727"]
};
$.get('redis.csv', function (data) {
parse(data, options);
});
$.get('ledis.csv', function (data){
parse(data, options_ledis)
})
function parse(data, options) {
// Split the lines
var lines = data.split('\n');
$.each(lines, function(lineNo, line) {
var items = line.split(',');
// header line containes categories
if (lineNo == 0) {
$.each(items, function(itemNo, item) {
if (itemNo > 0) options.xAxis.categories.push(item);
});
}
// the rest of the lines contain data with their name in the first position
// #HACKS: lineNo < 7. The csv file contains empty line. Ignore the 7th line.
else if (lineNo < 8) {
var series = {
data: []
};
$.each(items, function(itemNo, item) {
if (itemNo == 0) {
series.name = item;
} else{
series.data.push(parseFloat(item));
}
});
options.series.push(series);
}
});
var chart = new Highcharts.Chart(options);
}
});
</script>
</head>
<body>
<!-- 3. Add the container -->
<div id="container" style="width: 1150px; height: 400px; margin: 0 auto"></div>
<div id="container_ledis" style="width: 1150px; height: 400px; margin: 0 auto"></div>
</body>
</html>