koolreport

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
crnjak
Posts: 13
Joined: 2021-12-29 20:25

koolreport

Post by crnjak » 2022-05-12 09:07

Greeting,
has anyone managed to integrate "koolreport" successfully with AppGini?

crnjak
Posts: 13
Joined: 2021-12-29 20:25

Re: koolreport

Post by crnjak » 2022-05-20 08:28

Hi,
so I try to integrate koolreport but not succesfuly. Over a last week i research for live graphic akording to data in table and I have suuccess with google bar-chart.
Here code and example
in table_view.php file before // hook: table_footer add this code
-----------------------------------------------------------------------------------------------------------------
//grafikon

$footerCode = '';
if(function_exists('table_footer')) {
$args = [];
$footerCode = table1_footer($x->ContentType, getMemberInfo(), $args);
}

if(!$footerCode) {
include_once(__DIR__ . '/barchart.php');
} else {
ob_start();
include_once(__DIR__ . '/barchart.php');
echo str_replace('<%%FOOTER%%>', ob_get_clean(), $footerCode);
}
-----------------------------------------------------------------------------------------------------------------
Then create barchart.php in root code for barchart.php:
-----------------------------------------------------------------------------------------------------------------
<?php include "db1.php";?>
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAnnotations);

function drawAnnotations() {
var data = google.visualization.arrayToDataTable([
['field1', 'field2'],
<?php
$query="select * from table";
$res=mysqli_query($conn,$query);
while($data=mysqli_fetch_array($res)){
$field1=$data['field1'];
$field2=$data['field2'];
?>
['<?php echo $field1;?>',<?php echo $field2;?>],
<?php
}
?>
]);

var options = {
chart: {
title: 'YOUR TITLE',
subtitle: 'YOUR SUBTITLE',
},

bars: 'vertical'
};

var chart = new google.charts.Bar(document.getElementById('barchart_material'));

chart.draw(data, google.charts.Bar.convertOptions(options));
}
</script>
</head>
<body>
<div id="barchart_material" style="width: 700px; height: 500px;"></div>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------
db1.php is connection to your database

results for me look like this in attachment

PS I am awere that is not best solutions but for me and my purpose its work great you are welcome to give some advice and another solutions
Attachments
Untitled.jpg
Untitled.jpg (58.71 KiB) Viewed 152 times

Post Reply