This is a sample how to update a chart dynamicly. If effect selected and button below clicked it will trigger an event script in file "draw_event.js", which then will re-draw the current chart using the selected effect.
include_once "environment.php";
use phpRGraph\rgraph_chart;
use phpRGraph\rgraph_options;

$template = "effect1.php";

$id = "cvs";
$chart_type = "Bar";
$draw_option = "draw();";
$width = "600";
$height = "350";

$data = array( 40,50,80,30,50,60,70 );
$labels = array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
$chart = new rgraph_chart("cvs", $data, "Bar");

$options = new rgraph_options("default.ini");
$options->set_option("title", "Some Bar Chart Effects");
$options->set_option("xaxisLabels", $labels);
$options->set_option("xaxisLabelsAngle", 20);
$options->set_option("yaxisScaleMax", 90);
$options->set_option("variant","glass");

$chart->set_options($options);
$rgraph_json = $chart->toString();

$chart_script = "";
$event_script = $chart->getEventScript("draw_event.js");

$canvas_style="z-index: 0;";

include_once ($templates . $template);
?>