/home/mjc1/public_html/emillennium/jsondata_sale_old.php


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
<?php
include("_common.php");

$sdate date("Y-m-d",time()-(60*60*24*7));
$edate date("Y-m-d",time());

$sql "select a.dealdate, sum(b.tot_amt) as sum_tot
    from sale_m a left join sale_d b on a.midx = b.midx
    where 1=1 and a.dealdate >= '
{$sdate}' and a.dealdate <= '{$edate}'
    group by a.dealdate
"
;
$json "";
$res mysql_query($sql,$connect_e1000y);
while(
$info mysql_fetch_array($res)){
    
$data substr($info['dealdate'],0,10);
    
$json .= "[\"{$data}\",".round($info['sum_tot'])."],";
}
$json "[".substr($json,0,strlen($json)-1)."]";
?>
<html>
<head>
    <script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/jquery.jqplot.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.barRenderer.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.highlighter.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.cursor.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.pointLabels.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
    <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.logAxisRenderer.min.js"></script>
    <link rel="stylesheet" type="text/css" href="./lib/jqplot//jquery.jqplot.min.css" />
    <script>
    $(function(){
        graph1('chart1','매출');
    });

    function graph1(chart_name,title){
         goog = <?php echo $json;?>;
     
        var plot1 = $.jqplot(chart_name, [goog], { 
            animate: true,
            title: title+' 그래프', 
            series: [{ 
                label: title+' 그래프', 
                neighborThreshold: -1 ,
                lineWidth:2
            }], 
            seriesDefaults: { 
                showMarker:true,
                pointLabels: { show:true } 
              },
            axes: { 
                xaxis: { 
                    renderer:$.jqplot.DateAxisRenderer,
                    tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                    tickOptions: {
                        formatString: "%F"
                    }
                },
                yaxis: {
                    tickOptions: {
                        formatString: "%'d"
                    },
                    rendererOptions: {
                        forceTickAt0: true
                    }
                }
            }, 
            cursor:{
                show: true, 
                zoom: true
            } 
        });
    }
    </script>
</head>
<body style='margin:0px;padding:0px;'>
<div class="jqPlot" id="chart1" style="width:350px; height:235px; "></div>
</body>
</html>