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
179
180
181
182
183
184
185
186
187
188
|
<?php include("./_common.php"); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src='/js/jqueryui/jquery-ui.js'></script> <link href="/js/jqueryui/jquery-ui.css" rel="stylesheet" type="text/css"> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
<?php
if($flg == "movie") {
$sql = "SELECT sum(count) AS cnt, page_kr FROM mBoard_page_count WHERE inflow_date BETWEEN '{$txtdate}' AND '{$txtdate2}' AND page = 'youtube' GROUP BY page_kr ORDER BY page_kr ASC"; $res = mysql_query($sql,$connect_web); if(!$res) { echo "µ¥ÀÌÅÍ Ãëµæ¿¡ ½ÇÆÐÇß½À´Ï´Ù. <br>".mysql_error(); } ?>
<style> table { border-collapse: collapse; border-spacing: 0; border: 0 none; } .counter_table th { width: 195px; } .counter_table th, .counter_table td, .counter_table tr { height: 33px; padding: 2px 2px 0; text-align: center; line-height: 33px; border: 1px solid #bdbebd; } </style>
<div class="counter_div"> <table class="counter_table"> <thead> <tr> <th>¿µ»ó¸í</th> <th>Ä«¿îÆ®</th> </tr> </thead> <tbody>
<?php while($info = mysql_fetch_array($res)) { ?>
<tr> <td><?php echo $info['page_kr']; ?></td> <td><?php echo $info['cnt']; ?></td> </tr>
<?php } ?>
</tbody> </table> <p>¡Ø ¸®½ºÆ®¿¡ ¾ø´Â ¿µ»óµéÀº Ä«¿îÆ®°¡ 0ÀÔ´Ï´Ù.</p> </div>
<?php } else {
$sql = "SELECT inflow_time, SUM(count) as count FROM mBoard_page_count WHERE inflow_date BETWEEN '{$txtdate}' AND '{$txtdate2}' AND PAGE = '{$page}' GROUP BY inflow_time ORDER BY inflow_time ASC"; $res = mysql_query($sql,$connect_web); if(!$res) { echo "µ¥ÀÌÅÍ Ãëµæ¿¡ ½ÇÆÐÇß½À´Ï´Ù. <br>".mysql_error(); } while($info = mysql_fetch_array($res)) { $cnt_array[] = $info; } ?>
<style> table { border-collapse: collapse; border-spacing: 0; border: 0 none; } .counter_table th { width: 195px; } .counter_table th, .counter_table td, .counter_table tr { height: 33px; padding: 2px 2px 0; text-align: center; line-height: 33px; border: 1px solid #bdbebd; } .counter_ttl { font-weight: bold; text-align: center; font-size: 25px; margin: 25px 0; } </style>
<div class="counter_div"> <p class="counter_ttl"><?php echo urldecode($pagekr); ?></p> <?php for($i = 0; $i < 24; $i++) { // ½Ã°£´ë¸¸Å µ¹¸²
for($j = 0; $j < count($cnt_array); $j++) { // Ä«¿îÆ® µ¥ÀÌÅÍ µ¹¸®±â $info = $cnt_array[$j]; // µ¥ÀÌÅÍ »Ì¾Æ³»±â $count = ""; // º¯¼öÃʱâÈ
if($i != (int)$info['inflow_time']) { // »Ì¾Æ³½ ½Ã°£´ë¿Í Ä«¿îÆ®µ¥ÀÌÅÍÀÇ ½Ã°£ÀÌ ¸ÂÁö¾ÊÀ¸¸é $flg = false; } else { // ½Ã°£ÀÌ ¸ÂÀ¸¸é $day_list .= (int)$info['count'].","; // ¼±Â÷Æ®ÀÇ xÃàÀ» À§ÇÑ ÀúÀå $flg = true; break 1; // ±×¸®°í for¹® Å»Ãâ } }
// flg°¡ false À̸é if ($flg == false) { $day_list .= 0; $day_list .= ","; } }
// ¹®ÀÚ¿·Î ÀúÀåÇÑ °Ô½Ã¹°ÀÇ °¹¼öÀÇ ¸Ç µÚ¿¡ , Á¡À» Áö¿ò $day_list = substr($day_list, 0, strlen($day_list)-1); ?>
<canvas id="ct-chart1"></canvas> </div>
<script> $(function(){ line_graph_up(); function line_graph_up(){ const ctx = document.getElementById('ct-chart1'); new Chart(ctx, { plugins: [ChartDataLabels], type: "bar", data: { labels: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24'], datasets: [{ label: "Á¢¼Ó ¼ö", data: [<?php echo $day_list; ?>], backgroundColor: '#2f6ba9' }] }, options: { scales: { x: { grid: { color: "transparent", } }, y: { beginAtZero: true } }, plugins: { datalabels: { display: true, color: 'white', anchor: 'end', align: 'start', formatter: function (value) { if(value == 0) return ""; else return value; }, font: { size: 16, weight: 'bold', } } } } }); }; }); </script> <?php } //if flg=movie else ?>
|