- <?php
- $mysqli = new mysqli('localhost','root','root','datbas');
- $sql = "select * from itg1 order by pv desc ,uv desc limit 10";
- $result = $mysqli->query($sql);
- $host = array();
- $pv = array();
- $uv = array();
- while($row = $result->fetch_assoc()){
- $host[] = $row['host'];
- $pv[] = intval($row['pv'])/1000000;
- $uv[] =intval($row['uv'])/10000;
-
-
- }
-
-
-
-
-
-
-
-
-
- ?>
- <html>
- <head>
- <script type="text/javascript" src="http://www.t1xy.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
- <script type="text/javascript" src="http://www.t1xy.com/highcharts.js"></script>
- <script>
- var hostj = <?php echo json_encode($host)?>;
- var pvj = <?php echo json_encode($pv)?>;
- var uvj = <?php echo json_encode($uv)?>;
-
-
-
-
- $(function (){
- $('#container').highcharts({
- chart: {
- type: 'column'
- },
- title: {
- text: 'Traffic of the Top 10 Websites in China'
- },
- xAxis: {
- categories: hostj
- },
- yAxis: {
- title: {
- text: 'visit'
- }
- },
- series: [{
- name: 'pv(百万)',
- data: pvj
- }, {
- name: 'uv(万)',
- data: uvj
- }]
- });
- });
- </script>
- </head>
-
- <body>
- <div id="container" style="min-width:800px;height:400px;"></div>
- </body>
- </html>
posted @
2014-05-22 12:09
:快乐王子
阅读(
925)
评论()
编辑
收藏
举报