A new RGraph feature is the clipping extension, introduced in version 6.17. This new addition to RGraph allows you to easily restrict the drawing to a certain part of the canvas making it very easy to combine charts - for example different colored Line charts like the example shown here.
The clipping option can be one of multiple formats so you can easily restrict the drawing on the canvas to a shape, half of the canvas, a percentage of the scale (for scaled charts eg Bar, Line, Scatter) or a specific scale value.

<?php

use phpRGraph\rgraph_chart;
use phpRGraph\rgraph_options;
include_once "environment.php";
include_once $utility;
/span>
// rgraph charts
$template = "combine_two.php";

$id = "cvs";
$draw_option = "draw();";
$width = "700";
$height = "350";

$data = array(4,8,6,3,2,4,-5,-4,5,6,-1,-9,1,2,-3,-5,-7,-4,-2,-2,6,2,3,4,
        4,8,6,2,3,5,1,4,9,5,6,4,3,8,7,5,6,4,5,1,2,3,4,6);

// setup chart1

$chart1 = new rgraph_chart("cvs", $data, "Line");
$options1 = new rgraph_options("demo.ini");
$options1->set_option("title", "Line Chart using Clip Option");
$options1->set_option("colors", array('red'));
$options1->set_option('filledColors', array('rgba(255,128,128,0.25)') );
$options1->set_option('clip', 'tophalf');
$chart1->set_options($options1);
$chart1_json = $chart1->toPrettyString();

$event1_script = "";
$chart1_script = "";

// setup chart2

$chart2 = new rgraph_chart("cvs", $data, "Line");
$options2 = new rgraph_options("demo.ini");
$options2->set_option("colors", array('blue'));
$options2->set_option('filledColors', array('rgba(128,128,255,0.25)') );
$options2->set_option('clip', 'bottomhalf');
$chart2->set_options($options2);
$chart2_json = $chart2->toString();

$event2_script = "";
$chart2_script = "";

include_once ($templates . $template);

?>