php-reports icon indicating copy to clipboard operation
php-reports copied to clipboard

How to use charts?

Open rottenrabbit opened this issue 10 years ago • 1 comments

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!

rottenrabbit avatar Apr 30 '15 11:04 rottenrabbit

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 [email protected] 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.

jdorn avatar Apr 30 '15 13:04 jdorn