Print

Report Graphs



Sample Data


Below is the sample table used..

CREATE TABLE  `test_graph` (
`test_graph_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`xlabel` VARCHAR( 44 ) NOT NULL ,
`label` VARCHAR( 11 ) NOT NULL ,
`yvalue` INT NOT NULL
) ENGINE = MYISAM ;
 
INSERT INTO  test_graph (test_graph_id,xlabel,label,yvalue) VALUES 
(1,'JAN','A',3),
(2,'FEB','A',6),
(3,'JAN','B',9),
(4,'FEB','B',12),
(5,'MAR','B',15),
(6,'JAN','C',18),
(7,'MAR','A',21),
(8,'APR','B',24),
(9,'FEB','C',27),
(10,'APR','A',30),
(11,'MAR','C',33),
(12,'APR','C',36);


Data For Report


In the PHP Data Code we can put the following..

nuRunQuery("CREATE TABLE #dataTable# SELECT * FROM test_graph");



Data For Graph


The Report Graph Object displays graphs created under the Report Graph Tab of an Activity.

The point of Graph Code is to create a temp table (#graphTable#) with data that Graph Type can then display.

$s  = "CREATE TABLE #graphTable# ";
$s .= "SELECT xlabel,label,yvalue ";
$s .= "FROM test_graph WHERE label = '#the_label#'";
nuRunQuery($s);


the_label in this case is a hash variable passed via the parameter field of the graph object in a report.



The value of #the_label# changes as the report is run..



So does the data displayed by the graph.







Created by: steven. Last Modification: Wednesday 29 of August, 2012 16:05:16 CST by steven.