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
|
<?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 = ""; $d1 = ""; $l1 = ""; $res = mysql_query($sql,$connect_e1000y); while($info = mysql_fetch_array($res)){ $data = substr($info['dealdate'],5,10); $d1 .= round($info['sum_tot']).","; $l1 .= "'".$data."',"; } $d1 = "[".substr($d1,0,strlen($d1)-1)."]"; $l1 = "[".substr($l1,0,strlen($l1)-1)."]"; ?> <html> <head> <script 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.pieRenderer.min.js"></script> <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script> <script type="text/javascript" src="./lib/jqplot/plugins/jqplot.pointLabels.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){ $.jqplot.config.enablePlugins = true; var s1 = <?php echo $d1;?>; var ticks = <?php echo $l1;?>; plot1 = $.jqplot('chart1', [s1], { // Only animate if we're not using excanvas (not in IE 7 or IE 8).. title: title+' 그래프', series: [{ label: title+' 그래프', neighborThreshold: -1 , lineWidth:2 }], animate: !$.jqplot.use_excanvas, seriesColors:['#85802b', '#00749F', '#73C774', '#C7754C', '#17BDB8', '#00749F', '#73C774'], seriesDefaults:{ renderer:$.jqplot.BarRenderer, pointLabels: { show: true }, rendererOptions: { // Set varyBarColor to tru to use the custom colors on the bars. varyBarColor: true }
}, axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks }, yaxis: { tickOptions: { formatString: "%'d" }, rendererOptions: { forceTickAt0: true } } }, highlighter: { show: true }, cursor:{ show: true, zoom: true } }); } </script> </head> <body style='margin:0px;padding:0px;'> <style> #chart1 {font-size:0.8em;} </style> <div class="jqPlot" id="chart1" style="width:350px; height:235px; "></div> </body> </html>
|