PHP
- 2 ответа
- 0 вопросов
2
Вклад в тег
<?
$r = array();
$d = array();
$query = $mysqli->query("SELECT * FROM history WHERE id2='1' ORDER BY id DESC LIMIT 10");
while ($set = $query->fetch_array()) {
$r[] = $set['sum'];
$d[] = '"'.date("d.m", $set['time']).'"';
}
$dt = implode(", ", $d);
$str = implode(", ", $r);
?>
<tr><td colspan="7">
<canvas id="buyers" width="500" height="200" class="tgr">
<script>
var myArr = [<?=$str?>];
var Date = [<?=$dt?>];
var buyers = document.getElementById('buyers').getContext('2d');
var buyerData = {
labels : Date,
datasets : [
{
fillColor : "rgba(172,194,132,0.4)",
strokeColor : "#ACC26D",
pointColor : "#fff",
pointStrokeColor : "#9DB86D",
data: myArr
}
]
}
</script>
<script>new Chart(buyers).Line(buyerData);</script></canvas>
<?
$r = array();
$d = array();
$query = $mysqli->query("SELECT * FROM history WHERE id2='1'");
while ($set = $query->fetch_array()) {
$r[] = $set['sum'];
$d[] = '"'.date("d.m", $set['time']).'"';
}
$dt = implode(", ", $d);
$str = implode(", ", $r);
?>
var myArr = [<?=$str?>];
var Date = [<?=$dt?>];