include?'mysql.php';
include?"../charts.php";
//?Get?ad?id
if?(!isset($_GET['ad']))?{?no_chart();?}
$ad?=?intval($_GET['ad']);
//?Get?data?for?last?31?days
$days?=?$db->sql_query?("SELECT?year,?month,?day,?views,?clicks,?ctr?FROM?stats?WHERE?ad?=?$ad?AND?type?=?'day'?ORDER?BY?month?DESC,?day?DESC?LIMIT?0,31");
if?(count($days)?==?0)?{
????no_chart();
}
$days?=?array_reverse($days);
//?Create?chart?data
$daynames?=?array('');
$clicks?=?array('Clicks');
$views?=?array('Impressions');
foreach?($days?as?$day)?{
????$daynames[]?=?date('j?M',?mktime(0,?0,?0,?$day['month'],?$day['day'],?$day['year']));
????$clicks[]?=?$day['clicks'];
????$views[]?=?$day['views'];
}
$chart['chart_data']?=?array($daynames,?$clicks,?$views);
$chart['axis_value']?=?array('color'?=>?'FFFFFF');
$chart['axis_category']?=?array('color'?=>?'FFFFFF',?'size'?=>?'10',?'skip'?=>?5);
$chart['axis_ticks']?=?array('value_ticks'?=>?true,?'minor_color'?=>?'FFFFFF');
$chart?[?'chart_value'?]?=?array?('position'?=>??"cursor",?'bold'?=>??true,?'size'?=>??11,?'color'?=>?"FFFFFF",?'alpha'?=>?190);?
$chart['chart_type']?=?'stacked?column';
SendChartData?($chart);
function?no_chart()?{
????$chart['chart_data']?=?array(array('',?'No?Data?Available'));
????$chart['axis_category']?=?array('color'?=>?'FFFFFF');
????SendChartData($chart);
}
?>