16. Line graph [y = ex]
The code below is the source for this graph.
<?php
// 16. Line graph [y = e<sup>x</sup>]
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'back_colour' => '#eee',
'back_stroke_width' => 0,
'back_stroke_colour' => '#eee',
'stroke_colour' => '#000',
'axis_colour' => '#333',
'axis_overlap' => 3,
'grid_colour' => '#999',
'label_colour' => '#000',
'axis_font' => 'Arial',
'axis_font_size' => 10,
'fill_under' => true,
'pad_right' => 0,
'pad_left' => 10,
'marker_type' => 'circle',
'marker_size' => 3,
'marker_colour' => 'blue',
'minimum_grid_spacing' => 20,
'structure' => ['key' => 0, 'value' => 1],
'fill_opacity' => 0.7,
];
$width = 300;
$height = 300;
$type = 'LineGraph';
$values = [];
for($x = 1; $x <= 8; $x += 0.25) {
$values[] = ['e^' . $x, pow(M_E, $x)];
}
$colours = [ ['#010130','#e0e0e0'], ];
$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $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.