Curved best-fit lines
The code below is the source for this graph.
<?php
// Curved best-fit lines
require_once 'SVGGraph/autoloader.php';
$colours = ['#e11', '#1b1', '#11e', '#888'];
$settings = [
'auto_fit' => true,
'show_tooltips' => false,
'back_stroke_width' => 0,
'grid_division_v' => 10,
'marker_size' => 4,
'marker_type' => 'cross',
'grid_back_colour' => '#f9f9f9',
'pad_left' => 5,
'pad_top' => 5,
'pad_right' => 5,
'pad_bottom' => 5,
'structured_data' => true,
'best_fit' => 'curve',
'best_fit_colour' => 'fillColour',
'grid_back_stripe' => true,
'grid_back_stripe_colour' => '#fff',
];
$type = 'MultiScatterGraph';
$values = [];
srand(100);
for($i = 2; $i < 12; ++$i) {
for($c = 1; $c < 5; ++$c) {
$val = [$i + 0.05 * (rand(1, 100) - 50)];
$val[$c] = $c + 0.95 * rand($c, 100);
$values[] = $val;
}
}
$graph = new Goat1000\SVGGraph\SVGGraph(600, 200, $settings);
$graph->colours($colours);
$graph->values($values);
$graph->render($type);
Please note: the source code above comes from a script used to generate one of the example graphs on the site. This is simply a wrapper page to apply highlighting and make the source code easier to read, so there is no content here to describe what the source code is doing.