Home Forums Chart Support Chart Graph not showing dates Reply To: Chart Graph not showing dates

#41597

Giant,

It looks like you are trying to use a condition to check if the income data is not null and then adding both the income and expense datapoints. The query provides the result as null, however, to show 0 on the chart, you can remove the if condition if($resultRows['iamt']!=null) { ... } and use (int) to typecast null value as 0, as shown in the code-snippet below,

foreach ($result as $resultRows) {
   array_push($dataPoints1, array("x" => strtotime(date($resultRows['exp_dt'])) * 1000, "y" => (int) $resultRows['iamt']));
   array_push($dataPoints2, array("x" => strtotime(date($resultRows['exp_dt'])) * 1000, "y" => (int) $resultRows['eamt']));
}


Adithya Menon
Team CanvasJS