Data and labels for this 3d bar chart have been fetched from a Joomla database.
Note that method rgraph_chart::getDataFromDB may be called statically.
Properties for the chart are not set individually but are provided
by a (ini) file and built by the constructor of the rgraph_options object.
<?php
include_once "environment.php";
// rgraph chart
$template = "default.php";
$id = "cvs";
$draw_option = "draw();";
$width = "600";
$height = "400";
$db_config_file = $_SERVER["DOCUMENT_ROOT"] . "/configuration.php";
$sql="Select title, hits From jos_content Order By hits Desc Limit 10";
$db_data = rgraph_chart::getDataFromDB($db_config_file, $sql);
$chart = new rgraph_chart("cvs", $db_data[1], "Bar");
$options = new rgraph_options("bar_3d.ini");
$options->set_option("title", "Most Read Articles");
$options->set_option("xaxisLabels", $db_data[0]);
$options->set_option("tooltipsPositionStatic", false);
$options->set_tooltip($db_data[1], "#label# <br /> #val# Hits");
$chart->set_options($options);
$rgraph_json = $chart->toString();
$event_script = "";
$chart_script = "";
include_once ($templates . $template);
?>