-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart.jsp
178 lines (160 loc) · 4.52 KB
/
chart.jsp
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="resources/">
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>chart</title>
<meta charset="utf-8">
<style>
* {
margin: 0;
padding: 0;
}
div {
padding: 0px;
overflow: hidden;
height: auto;
}
.hgroup {
padding: 20px;
background-color: #e9e9e9;
}
.hgroup h1 {
font-family: Tahoma;
}
.hgroup p {
margin: 10px 0;
font-size: 10px
}
h2 {
margin: 0;
padding: 20px;
border: 1px solid #000;
background-color: #f9f9f9;
border-width: 1px 0;
font-family: Tahoma;
}
</style>
<link rel='stylesheet' href='css/Nwagon.css' type='text/css'>
<script src='js/Nwagon.js'></script>
<script src="vendor/jquery/jquery.min.js"></script>
</head>
<body>
<div id="Nwagon"></div>
<div id="Nwagon1"></div>
<script>
var charData = (function() {
var host = "http://localhost:8080";
function getRank(callback) {
$.getJSON(host + '/rank', callback);
}
return {
getRank : getRank
}
})();
charData.getRank(getData);
let options1 = {};
function getData(data) {
//console.log(data);
let legend = {};
let names = [];
let hrefs = [
'http://nuli.navercorp.com/sharing/blog/post/1132444',
'http://nuli.navercorp.com/sharing/blog/post/1132442',
'http://nuli.navercorp.com/sharing/blog/post/1132439',
'http://nuli.navercorp.com/sharing/blog/post/1132426',
'http://nuli.navercorp.com/sharing/blog/post/1115205',
'http://nuli.navercorp.com/sharing/blog/post/1111811',
'http://nuli.navercorp.com/sharing/blog/post/1111181',
'http://nuli.navercorp.com/sharing/blog/post/1096163',
'http://nuli.navercorp.com/sharing/blog/post/1079940' ];
let title = [];
let values = [];
let dataset = {};
dataset.title = 'Seamoonan rank per time';
for (let i = 0; i < data.rank.length; i++) {
names.push(data.rank[i].name);
values.push(data.rank[i].totalpoint);
}
/* console.log("--------");
console.log(names);
console.log(values);
console.log("--------"); */
dataset.values = values;
dataset.colorset = [ '#DC143C', '#FF8C00', "#30a1ce" ];
legend.names = names;
legend.hrefs = hrefs;
options1.legend = legend;
options1.dataset = dataset;
options1.chartDiv = 'Nwagon1';
options1.chartType = 'column';
options1.chartSize = {
width : 700,
height : 300
};
options1.maxValue = 1000;
options1.increment = 100;
Nwagon.chart(options1);
console.log(options1);
}
//console.log(options1);
//Nwagon.chart(options1);
// 여기 잘 모르겟음 나중에 구현해볼 것
/* (function() {
var host = "http://localhost:8080";
var root = this;
// I have to study this code 2018.06.14 module pattern
// var version = '1.0';
var Module1;
if (typeof exports !== 'undefined') {
Module1 = exports;
} else {
Module1 = root.Module1 = {};
}
Module1.getVersion = function(callback) {
return $.getJSON(host + '/rank', callback);
//return version;
}
}()); */
/* var name11 = [];
for (var i = 0; i < 5; i++) {
name11.push(i);
console.log(name11[i]);
}
console.log('ddddddddddd');
console.log(name11); */
var options = {
'legend' : {
names : [ 'EunJeong', 'HanSol', 'InSook', 'Eom', 'Pearl',
'SeungMin', 'TJ', 'Taegyu', 'YongYong' ],
hrefs : [
'http://nuli.navercorp.com/sharing/blog/post/1132444',
'http://nuli.navercorp.com/sharing/blog/post/1132442',
'http://nuli.navercorp.com/sharing/blog/post/1132439',
'http://nuli.navercorp.com/sharing/blog/post/1132426',
'http://nuli.navercorp.com/sharing/blog/post/1115205',
'http://nuli.navercorp.com/sharing/blog/post/1111811',
'http://nuli.navercorp.com/sharing/blog/post/1111181',
'http://nuli.navercorp.com/sharing/blog/post/1096163',
'http://nuli.navercorp.com/sharing/blog/post/1079940' ]
},
'dataset' : {
title : 'Playing time per day',
values : [ 5, 7, 2, 4, 6, 3, 5, 2, 10 ],
colorset : [ '#DC143C', '#FF8C00', "#30a1ce" ]
},
'chartDiv' : 'Nwagon',
'chartType' : 'column',
'chartSize' : {
width : 700,
height : 300
},
'maxValue' : 10,
'increment' : 1
};
//console.log(options);
Nwagon.chart(options);
</script>
</body>
</html>