KoolReport's Forum

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

Data column(s) for axis #0 cannot be of type string #665

Open gkurl opened this topic on on Feb 11, 2019 - 6 comments

gkurl commented on Feb 11, 2019

Hi Guys,

I keep getting the error "Data column(s) for axis #0 cannot be of type string" when attempting to create a BarChart - not sure if bug or problem with the way I'm formatting my code?

my PHP:

                      <?php
                     //sickness vs shifts per day
                     BarChart::create([
                    "dataStore" => resultset11,
                    "columns" => ["DOW", "Count"]
                    ]);
                     ?>

My resultset:

DOW is day of week, and count is the count of shift types that have appeared on that, I want to show a Bar chart that displays Shifts vs Sickness by day of the week (although I am not getting any data out for Sickness just yet).

In my stored procedure, I am ensuring that the columns are CAST as UNSIGNED (so basically an INT) but I am still receiving this message?

Please let me know any insight! Thank you! :)

gkurl commented on Feb 11, 2019

Ok I managed to get a Bar Chart to show, but it's not showing the correct data, I keep getting "All series on a given axis must be of the same data type"

How can I show the occurrence using the "count" of two different type of shifts ("SHIFT" and "SICK") - I have updated OP with up to date resultset showing at least one type of "SICK" shift.

Andrew Jarick commented on Oct 16, 2020

Did you solve this? I am having a similar issue

David Winterburn commented on Oct 16, 2020

Please try to change the metadata of the all columns except for the first one to ["type" => "number"]. The first one should have ["type" => "string"].

Kevin commented on Nov 22, 2020

Did you figure this out. I'm having the same issue.

David Winterburn commented on Nov 23, 2020

Hi Kevin,

Did you try to change your columns' meta data so that the first column is of type "string" while the others are of type "number"? Thanks!

Kevin commented on Nov 23, 2020

i did and that fixed it.

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
solved

None