KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to display alternative text and avoid error in Google Chart when there is no data #317

Closed KoolReport opened this topic on on Jun 13, 2018 - 1 comments

KoolReport commented on Jun 13, 2018

Question: I used Google Line Chart, however it shows error when there is no data available, how can I show a custom text in this case?

Answer: Very simple, you check the number of data row first before display chart

<?php
if($this->dataStore("mystore")->countData()>0)
{
    LineChart::create(array(
        "dataSource"=>$this->dataStore("mystore"),
        ...
    ));
}
?>
Jesus Laya commented on Feb 12, 2021

Hi, good morning, I'm Jesus, I'm doing a widget practice and when I build the chart it shows me this message "[No data available in chart]". Do you know why it will be?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
wiki

None