-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph_2.html
112 lines (91 loc) · 3.09 KB
/
graph_2.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
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
<title>통계2</title>
<script src="js/echarts-5.0.2.min.js"></script>
<script src="js/jquery.min.js"></script>
<link rel="stylesheet" href="./css/graph_2.css">
<script type="text/javascript" src="js/graphDB.js"></script>
<script src="js/paymentDB.js"></script>
<script>
$(document).ready( function() {
// DB 연결
openDB();
createTable();
// 查询当前年份月份的数据
var month = $('#graphMonth').val();
var pitchData = $('#graphMonth option:selected').text();
console.log(pitchData);
readCategoryPayment('all', undefined, month)
// console.log(allData);
// 이벤트 함수 정의
});
</script>
</head>
<body>
<nav>
<div class="menu-btn">
<div class="menu">MENU</div>
<div class="line line--1"></div>
<div class="line line--2"></div>
<div class="line line--3"></div>
</div>
<div class="nav-links">
<a href="main.html" class="link">◼ Home</a>
<a href="map.html" class="link">◼ 소비 위치정보</a>
<a href="graph.html" class="link">◼ 월별 통계</a>
<a href="graph_2.html" class="link">◼ 카테고리별 통계</a>
<a href="settings.html" class="link">◼ 설정</a>
</div>
</nav>
<div class="inform" height=100% width=100% >
<div class="month">
<select class="monthselect" name="graphMonth" id="graphMonth">
<option class="monthoption" value="1">2021년01월</option>
<option class="monthoption" value="2">2021년02월</option>
<option class="monthoption" value="3">2021년03월</option>
<option class="monthoption" value="4">2021년04월</option>
<option class="monthoption" value="5">2021년05월</option>
<option class="monthoption" value="6">2021년06월</option>
</select>
</div>
<!-- <div class="graphicalbutton">
<div class="brokenline"><a href="graph.html" class="logofont">그래프</a>
</div>
<div class="circular" name="circular1" id="circular1"><a href="" class="logofont">원형</a>
</div>
</div> -->
<div class="detailed" >
<div class="graphical" id="graphical"></div>
<div id='detail'></div>
</div>
</div>
<script src="js/graph_2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#graphMonth").change(() => {
var pitchData = $('#graphMonth option:selected').text();
var year = pitchData.split('년')[0]
var month = $('#graphMonth').val();
document.getElementById("graphical").removeAttribute('_echarts_instance_');
document.querySelector('#detail').innerHTML = ''
readCategoryPayment('all', year, month)
})
$("#detail").on('click', '#Adetailed', function(e) {
var index=$(this).index();
let DomArr = document.getElementById("detail").getElementsByTagName('div')
let category = queryDataValue(index, DomArr)
let month = $('#graphMonth').val();
window.location.href = "./detailed.html?month=" + month + '&category=' + category;
})
// 获取动态分类值
function queryDataValue(index, arr) {
let i = index * 10 + 5
return arr[i].innerText
}
});
</script>
</body>
</html>