Hi,
Thank you for your help,
Unfortunately I am not getting any graphs showing up with the below code, there is an error somewhere:
[php]
<?php
$query = “SELECT
SUM(cust_order_total) AS label,
due_date AS y
FROM orders
WHERE YEAR(due_date) = YEAR(CURDATE())
AND MONTH(due_date) = MONTH(CURDATE())
GROUP BY due_date
ORDER BY label”;
$rows = [];
$result = mysqli_query($connection,$query);
$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);
?>
<!–Graph1 Daily Chart —>
<script type=”text/javascript”>
window.onload = function () {
var jsonData = <?php echo json_encode($rows); ?>;
var dataPoints = [];
for (var i = 0; i <= jsonData.length – 1; i++) {
dataPoints.push({ x: new Date(jsonData[i].y), y: Number(jsonData[i].label) });
}
var chart = new CanvasJS.Chart(“chartContainer”, {
theme: “theme2”,
title:{
text: “Earthquakes – per month”
},
animationEnabled: true,
axisX: {
//valueFormatString: “MMM”,
interval:1,
intervalType: “week”
},
axisY:{
includeZero: false
},
data: [
{
type: “line”,
lineThickness: 3,
dataPoints: dataPoints
}
]
});
chart.render();
}
</script>
<div id=”chartContainer” style=”height: 300px; width: 100%;”></div>
[/php]