Im having message error when trying to view my chart
Warning (2): array_push() expects parameter 1 to be array, null given [APP/Template\Fusioncharts\index.ctp, line 31]
Here is the index.ctp
<?php
use Cake\Core\App;
//including the FusionCharts PHP wrapper
require_once(ROOT .DS. 'vendor' . DS . 'fusioncharts' . DS . 'fusioncharts.php');
use Cake\ORM\TableRegistry;
//connecting to the database table
$chartData = TableRegistry::get('mscombi2ddata');
//query to fetch the desired data
$query = $chartData->find();
//creating the array contains chart attribute
$arrData = array(
"chart" => array(
"animation"=>"0",
"caption"=> "Albertsons SuperMart",
"subCaption"=> "No. Of Visitors Last Week",
"xAxisName"=> "Day",
"yAxisName"=> "No. Of Visitors",
"showValues"=> "0",
"paletteColors"=> "#81BB76",
"showHoverEffect"=> "1",
"use3DLighting"=> "0",
"showaxislines"=> "1",
"baseFontSize"=> "13",
"theme"=> "fint"
)
);
foreach($query as $row) {
$value = $row["value1"];
array_push($data, array(
"label" => $row["category"],
"value" => $row["value1"]
)
);
}
$arrData["data"]=$data;
//encoding the dataset object in json format
$jsonEncodedData = json_encode($arrData);
// chart object
$columnChart = new FusionCharts("column2d", "chart-1", "100%", "300", "chart-container",
"json", $jsonEncodedData);
// Render the chart
$columnChart->render();
?>
// Container to render the chart
<div id="chart-container"></div>