Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Thanks, please see code example below:
use \koolreport\dashboard\Dashboard; use \koolreport\dashboard\widgets\KWidget;
class MyClass extends KWidget {
protected function onInit()
{
$this->use(\koolreport\amazing\ChartCard::class)
->settings(array(
"title"=>"MY TITLE",
"value"=>MyDB::table("table_call")->count()
->innerjoin...
.....other joint code here...
->run()->getScalar(),
"chart"=>array(
"type"=>"area",
"dataSource"=>MyDB::table("table_call")
->innerjoin...
.....other joint code here...
->groupBy("date")
->orderBy("date")
->run(),
"columns"=>array(
"date",
"call_id"=>array(
"type"=>"number"
In order to show the AreaChart, you will need to 2 axis, a category column + a value column. So in your query, you need to group and count. For example:
MyDB::table("table1")->groupBy("category column")->select("category column")->count()->run()
The category column
may be a product category or a date for example. So that the data input to AreaChart will be like this:
category | count |
---|---|
A | 123 |
B | 422 |
C | 222 |
Let me know if you need further assistance.
You can try
MyDB::table("table1")->groupBy("category column")->select("category column")->count("id of table 1")->run()
It could be the name of column provided in "columns" is not correct yet. May be your should try:
MyDB::table("table1")->groupBy("date")->select("date")->count("call_id")->alias("count_call_id")->run()
later in the "columns" you put
"columns"=>[
"date",
"count_call_id"
]
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo