<?php
include_once "environment.php";
// rgraph chart
$template = "default.php";
$draw_option = "grow();";
$width = "500px";
$height = "500px";
$file = $filedir[0] . "samples/population.data";
$chart = new rgraph_chart("cvs", null, "Bipolar");
$file_data = $chart->getDataFromFile($file);
$left = array_reverse($file_data['data'][1]);
$right = array_reverse($file_data['data'][0]);
for ($i=0; $i<101; $i++)
$labels[$i] = $i;
$labels = array_reverse($labels);
$chart->set_left($left);
$chart->set_right($right);
$options = new rgraph_options("default.ini");
$options->set_option("titleSize", 12);
$options->set_option("title", "World population by age\n\n");
$options->set_option("titleLeft", "Male");
$options->set_option("titleRight", "Female");
$options->set_option("backgroundGrid", false);
$options->set_option("scaleDecimals", 1);
$options->set_option("yaxisTickmarksCount", 0);
$options->set_option("labels", $labels);
$options->set_option("yaxisLabels", $file_data['labels'];);
$options->set_option("marginCenter", 30);
$options->set_option("colorsSequential", false);
$options->set_option("colors", array( $options->setOpacity("#339933",0.6) ));
$options->set_option("xaxisScaleMax", (float)0.8);
$options->set_option("xaxisScaleDecimals",2);
$options->set_tooltip_formatted(null, "Age #label#: #val#%", "Bipolar");
$options->set_option("tooltipsEvent", "onmousemove");
$chart->set_options($options);
$rgraph_json = $chart->toString();
$chart_script = "";
$event_script = "";
$canvas_style="background-image: url('images/worldmap.png');
background-size: 500px 400px;
background-repeat: no-repeat;";
include_once ($templates . $template);
?>