Labels and data for this 3d bar chart is retrieved from a csv file via method
"rchart::getCSVdata". In addition to the parameter for the file name, parameter "9"
has been specified because the five data columns start after row 9 (after the csv-header)
of the csv-file.
For the use of a background image the canvas style has been modified.
<?php
include_once "environment.php";
use phpRGraph\rgraph_chart;
use phpRGraph\rgraph_options;
// rgraph chart
$template = "default.php";
$id = "cvs";
$draw_option = "grow();";
$width = "800";
$height = "400";
$chart = new rgraph_chart("cvs", null, "Bar");
$csv_data = $chart->getCSVdata ("pv_system-201507.csv", 9);
$data = array($csv_data[2], $csv_data[4] );
$chart->set_data($data);
$chart->rearrangeData();
$options->set_option("title", "Power Yield PV System in May 2016");
$options->set_option("xaxisLabels", $csv_data[0]);
$options->set_option("colorsSequential", false);
$options->set_option("grouping", "stacked");
$options->set_option("scaleDecimals", 2);
$options->set_gradientColors();
$options->set_option("key", array("SMA Sunnyboy 1","SMA Sunnyboy 2"));
$options->set_option("keyPositionY", 20);
$options->set_option("keyPositionX", 500);
$options->set_option("marginBottom", 100);
$options->set_option("tooltipsPositionStatic", false);
$options->set_tooltip($chart->get_data(), "#key#
#label# #val#kWh
Total #total#kWh");
$labels = $options->xlabelsteps($csv_data[0],2);
$options->set_option("xaxisLabels", $labels);
$chart->set_options($options);
$rgraph_json = $chart->toString();
$canvas_style = "background-repeat: no-repeat;
background-image: url(images/pv_system.jpg); background-size: 100% 100%;";
$chart_script = "";
$event_script = "";
include_once ($templates . $template);
?>