ArtiGrid
Charts
ArtiGrid also includes built-in support for charts, allowing you to visualize your data directly from the database without additional libraries.
Using the chart_labels() method, you can define labels, multiple datasets,
and even execute SQL queries dynamically by prefixing them with #.
It supports different chart types such as bar, line, and pie, along with custom configuration options like scales and plugins.
With chart_view(true), you can easily toggle the chart display alongside your grid,
providing both tabular and visual representations of your data.
<?php
$chart = new ArtiGrid();
$chart->table('orderdetails')
->template('bootstrap5');
$chart->chart_labels(
['S24_2841', 'S24_3420', 'S24_3949', 'S24_4278', 'S32_4289', 'S50_1341'],
[
[
'label' => '# of Quantity Ordered',
'data' => '#select quantityOrdered from orderdetails where id IN (60,61,62,63,64,65)',
'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
'borderColor' => 'rgba(255, 99, 132, 1)',
'borderWidth' => 1
],
[
'label' => '# Price of Order',
'data' => '#select priceEach from orderdetails where id IN (60,61,62,63,64,65)',
'backgroundColor' => 'rgba(30, 23, 132, 0.2)',
'borderColor' => 'rgba(30, 23, 132, 0.2)',
'borderWidth' => 1
]
],
'pie',
[
'scales' => [
'y' => ['beginAtZero' => true]
],
'plugins' => [
'legend' => ['display' => true]
]
]
);
$chart->chart_view(true);
echo $chart->render();
?>