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
|
<?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_date, SUM(count) AS cnt FROM mBoard_page_count WHERE inflow_date BETWEEN '{$txtdate}' AND '{$txtdate2}' AND PAGE = '{$page}' GROUP BY inflow_date ORDER BY inflow_date ASC"; $res = mysql_query($sql,$connect_web); if(!$res) { echo "µ¥ÀÌÅÍ Ãëµæ¿¡ ½ÇÆÐÇß½À´Ï´Ù. <br>".mysql_error(); } while($info = mysql_fetch_array($res)) { $day_list .= $info['cnt'].","; $inflow_list .= "'".$info['inflow_date']."',"; $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 // ¹®ÀÚ¿·Î ÀúÀåÇÑ °Ô½Ã¹°ÀÇ °¹¼öÀÇ ¸Ç µÚ¿¡ , Á¡À» Áö¿ò $day_list = substr($day_list, 0, strlen($day_list)-1); $inflow_list = substr($inflow_list, 0, strlen($inflow_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: [<?php echo $inflow_list; ?>], 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 ?>
|