PK

ADDRLIN : /home/anibklip/ulpc.in/bkp2014-2015/
FLL :
Current File : //home/anibklip/ulpc.in/bkp2014-2015/graph_1.php

<?php
function getLeads($pub_id){
	$q="SELECT month(dt)  as mnth, count(*) as mnth_cnt FROM `users` where pub_id='$pub_id' and year(dt)=year(curdate()) group by mnth";
	$q=mysql_query($q) or die(mysql_error());

	while($r=mysql_fetch_array($q)){
		$delhi_cnt[$r[mnth]]=$r[mnth_cnt];
	}
	//echo "<pre>";print_r($delhi_cnt);echo "</pre>";
	for($i=1;$i<=12;$i++){
		$v= $delhi_cnt[$i];
		$str.=number_format($v,2).", ";
	}
	$str=substr($str,0,-2);
	return $str;
}
function getData($tbl, $cert_typo=''){
	//$q="SELECT *, month(issuedate) as mnth, count(*) as mnth_cnt FROM $tbl where year(issuedate)=year(curdate()) group by mnth";
	if($cert_typo) 
		$whr=" certypo='$cert_typo' ";
	else
		$whr=1;
	$q="SELECT *, month(issuedate) as mnth, count(*) as mnth_cnt FROM $tbl where $whr group by mnth";
	$q=mysql_query($q) or die(mysql_error());

	while($r=mysql_fetch_array($q)){
		$delhi_cnt[$r[mnth]]=$r[mnth_cnt];
	}
	//echo "<pre>";print_r($delhi_cnt);echo "</pre>";
	for($i=4;$i<=15;$i++){
		$ii=$i;

		if($i==13)$ii=1;
		if($i==14)$ii=2;
		if($i==15)$ii=3;

		$v= $delhi_cnt[$ii];
		$str.=number_format($v,0).", ";
	}
	$str=substr($str,0,-2);
	return $str;
} 

$AQIS_str=getData("cert_aqis", "b");
$PPQ_str=getData("cert_ppq");
$AUS_str=getData("cert_aqis", "d");
?>

<script type="text/javascript">
/*
$(function () {
$('#containerp').highcharts({
	title: {
		text: 'Publishers Stats',
		x: -20 //center
	},
	subtitle: {
		text: 'heartbeat.maxbupa.com',
		x: -20
	},
	xAxis: {
		categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
	},
	yAxis: {
		title: {
			text: 'Leads Conversion %'
		},
		plotLines: [{
			value: 0,
			width: 1,
			color: '#808080'
		}]
	},
	tooltip: {
		//valueSuffix: '%'
		formatter: function() {
			//Delhi Conversion Nov: 100%
			//return '<b>'+this.series.name+'</b> Conversion in <b>' + this.x + '</b>: ' + this.y + '%</b>' +'<br>Total Visits:22 <br> Total Leads:55 ';
			return '<b>'+this.series.name+'</b> Leads in <b>' + this.x + '</b>: ' + this.y + '</b>' +'';
		}
	},
	legend: {
		layout: 'vertical',
		align: 'right',
		verticalAlign: 'middle',
		borderWidth: 0
	},
	series: [{
		name: 'ValueFirst',
		data: [<?=$valuefirst_str?>]
		//data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
	}, {
		name: 'FreeRecharge',
		data: [<?=$freerecharge_str?>]
		//data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
	}, {
		name: 'GetIT',
		data: [<?=$getit_str?>]
		//data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
	}]
});
});
*/

$(function () {
        $('#container_bar').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Certificate Stats'
            },
            subtitle: {
                text: 'ulpc.in'
            },
            xAxis: {
                categories: [
                    'Apr',
                    'May',
                    'Jun',
                    'Jul',
                    'Aug',
                    'Sep',
                    'Oct',
                    'Nov',
                    'Dec',
					'Jan',
                    'Feb',
                    'Mar'
                ]
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Certificate Issued'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                    '<td style="padding:0"><b>{point.y:.1f} </b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
				name: 'AQIS',
				data: [<?=$AQIS_str?>]
				//data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
			}, {
				name: 'AUS',
				data: [<?=$AUS_str?>]
				//data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
			}, {
				name: 'PPQ',
				data: [<?=$PPQ_str?>]
				//data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
			}]

			 
        });
    });



</script>

<script src="js_chart/highcharts.js"></script>
 
<!-- <div id="containerp" style="min-width: 310px; height: 400px; margin: 0 auto"></div> -->

<div id="container_bar" style="min-width: 310px; height: 400px; margin: 0 auto"></div>



PK 99