jdorn / php-reports

A PHP framework for displaying reports from any data source, including SQL and MongoDB
http://jdorn.github.com/php-reports
GNU Lesser General Public License v3.0
478 stars 234 forks source link

How to use charts? #181

Open rottenrabbit opened 9 years ago

rottenrabbit commented 9 years ago

Hi, I've set up php-reports a few weeks back and so far am loving it. I've only been using basic SQL queries up until now, but I'm trying to build charts and have no idea where to start. I've tried variations of the following:

-- Test -- CHART: { -- "columns": ["Codes_Heard", "Days"], -- "type": "LineChart", -- "title": "Test", "width": "600px", -- "height": "400px" -- }

-- VARIABLE: { -- "name": "article", -- display: "Article ID's separated by , eg. 123,345,678" -- }

count(distinct(...)) as Codes_Heard, DATE(...) as Days from....

All I get is complaints of SQL syntax errors, and if I put the CHART section below the variable declaration, the query runs, but just displays the regular table. What am I doing wrong?

Many thanks for any assistance!

jdorn commented 9 years ago

Make sure there are no blank lines between headers. If there are 2 newline characters in a row, that signifies the end of the header and the start of the SQL query.

On Thu, Apr 30, 2015, 04:37 rottenrabbit notifications@github.com wrote:

Hi, I've set up php-reports a few weeks back and so far am loving it. I've only been using basic SQL queries up until now, but I'm trying to build charts and have no idea where to start. I've tried variations of the following:

-- Test -- CHART: { -- "columns": ["Codes_Heard", "Days"], -- "type": "LineChart", -- "title": "Test", "width": "600px", -- "height": "400px" -- }

-- VARIABLE: { -- "name": "article", -- display: "Article ID's separated by , eg. 123,345,678" -- }

count(distinct(...)) as Codes_Heard, DATE(...) as Days from....

All I get is complaints of SQL syntax errors, and if I put the CHART section below the variable declaration, the query runs, but just displays the regular table. What am I doing wrong?

Many thanks for any assistance!

— Reply to this email directly or view it on GitHub https://github.com/jdorn/php-reports/issues/181.