The Lasso feature is new in version 6.13 - it allows you to select points
on your Scatter chart and highlight them. There are a number of properties that are available
to you that allow you to customise that appearance and how the feature behaves (for example
a callback function so that you can integrate it into your existing code along with
persistence, custom persistence load/save functions and appearance customisation).
<?php
*/
include_once "environment.php";
use phpRGraph\rgraph_chart;
use phpRGraph\rgraph_options;
// rgraph chart
$template = "demo_lasso.php";
$draw_option = "draw();";
$width = "650";
$height = "400";
$chart = new rgraph_chart("cvs", null, "Scatter");
$x_values = array(156,157,159,160,161,162,165,170,170,171,172,173,173,177,178,184,188,189,190,194,196,200);
$y_values = array(162,160,162,159,162,170,166,170,167,169,174,173,176,173,178,180,188,182,185,193,190,196);
for ($i=0; $i<count($y_values); $i++)
{
$color[$i] = "blue";
$tooltip[$i] = "Body Size: " . $y_values[$i] . "cm
Arm Length: " . $x_values[$i] . "cm";
//$tooltip[$i] = "Körpergrösse: " . $y_values[$i] . "cm
Armlänge: " . $x_values[$i] . "cm";
}
$data = $chart->createScatterData($x_values, $y_values);
$chart->set_data($data);
$options = new rgraph_options("default.ini");
$options->set_option("marginLeft", 100);
$options->set_option("marginRight", 10);
$options->set_option("title","Body Size versus Length of Arms");
$options->set_option("lasso", true);
$options->set_option("lassoPersist", true);
$options->set_option("lassoPersisLocal", true);
$options->set_option("tickmarksStyle", 'circle');
$options->set_option("tickmarksSize", 6);
$options->set_option("title","Body Size versus Length of Arms");
$options->set_option("xaxisScale", true);
$options->set_option("xaxisScaleMin", 150);
$options->set_option("xaxisScaleMax", 200);
$options->set_option("yaxisScaleMax", 203);
$options->set_option("yaxisScaleMin", 150);
$options->set_option("yaxisScaleUnitsPost"," cm");
$options->set_option("yaxisTitle","Body Size");
$options->set_option("xaxisTitle","Length of Arms in cm");
$options->set_option("xaxisTitlePos",0.50);
$options->set_option("yaxisTitlePos",0.50);
$options->set_option("trendline", array(true));
$options->set_option("trendlineColors", array("red"));
$options->set_option("trendlineClipping", false);
$chart->set_options($options);
$rgraph_json = $chart->toPrettyString();
$chart_name = "scatter";
$event_script = "";
$chart_script = "";
include_once ($templates . $template);
?>