ORIENT/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm

30 lines
1.0 KiB
HTML
Raw Normal View History

2021-04-15 09:23:36 +00:00
<?php foreach($reklams as $id => $reklam):?>
<div
class="tab-pane active"
id="curve_chart_<?=$id?>" style="width:100%; height:400px; margin-top: 10px;">
</div>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawLineChart_<?=$id?>);
function drawLineChart_<?=$id?>(){
2023-02-17 06:39:53 +00:00
// var all = 20;
2021-04-15 09:23:36 +00:00
var data = google.visualization.arrayToDataTable([
['date', 'views', 'clicks',],
<?php foreach($reklam_stats->where('item_id',$id) as $stats):?>
2023-02-17 06:39:53 +00:00
['<?=date_format(date_create($stats->date),'m/d')?>', <?=$stats->view?>, <?=$stats->click?>],
2021-04-15 09:23:36 +00:00
<?php endforeach; ?>
]);
var options = {
2023-02-17 06:39:53 +00:00
title: '<?=$reklam?> <?=$count_view?>',
2021-04-15 09:23:36 +00:00
curveType: 'function',
legend: { position: 'bottom' }
};
var curve_chart = new google.visualization.LineChart(document.getElementById('curve_chart_<?=$id?>'));
curve_chart.draw(data, options);
}
</script>
<?php endforeach;?>