KoolReport's Forum

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

Koolreport with Laravel - data behind visualization #403

Open Madhukar opened this topic on on Jul 31, 2018 - 3 comments

Madhukar commented on Jul 31, 2018

Hey Koolreport Community,

I am new to koolreport and have been playing around with it for a couple of days. Is there a way to get data just before it's passed to the visualization widget. In other words, I wanted to know if there is a way to get the data behind Google charts/table and being able to modify it to satisfy our requirements?

Thanks,

KoolReport commented on Aug 1, 2018

Normally we will just input dataSource to chart widget like this:

LineChart::create(array(
    "dataSource"=>$this->dataStore("sale")
))

If you want to get out data and process them before going to the chart you can do:

$data = $this->dataStore("sale")->data(); 

Now you have the raw data in $data. It is just an two-dimensional array to represent table. You can further process $data before input to the chart like this

LineChart::create(array(
    "dataSource"=>$data
));

The "dataSource" of any widget can take DataStore object or simply array.

Please let me know if you need further assistance.

michael commented on Aug 3, 2018

I'm not the OP, but grabbing any ->data() on a datasource doesn't seem to give me anything, unless the report has been ->run()

Am I misunderstanding something?

KoolReport commented on Aug 3, 2018

That's correct, you need to call $report->run()->render();

The $this->dataStore("mydata")->data() works on the view of report. You can get the data before sending them to the chart to display.

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
help needed

Laravel