$ColumnChart = new Graph(); $ColumnChart->set_graphTitle("Hits Summary"); $ColumnChart->set_graphXLabel("Hour"); $ColumnChart->set_graphYLabel("Total Hits"); $ColumnChart->set_chartColumns(array("Hour", "Total Hits")); $result = $objDB->query("select Hour(datetime) as hour, count(*) as hits from hits group by 1 order by 1 desc;"); $index = 0; while ($line = $objDB->fetch_row($result)) { $rows[$index][0] = $line['hour']; $rows[$index][1] = $line['hits']; $index++; } $ColumnChart->set_chartRows($rows); $ColumnChart->set_chartGraph("ColumnChart"); $ColumnChart->get_chartGraph(); $objDB->sql_close(); // ------------------------------------------------------------------------------------------------------------------------------- $LineChart = new Graph(); $LineChart->set_graphTitle("Hits Summary"); $LineChart->set_graphXLabel("Hour"); $LineChart->set_graphYLabel("Total Hits"); $LineChart->set_chartColumns(array("Hour", "Total Hits")); $rows = array(0 => array(0, 5), 1 => array(1, 10), 2 => array(2, 15), 3 => array(3, 20)); $LineChart->set_chartRows($rows); $LineChart->set_chartGraph("LineChart"); $LineChart->get_chartGraph(); ?> </body> </html>