CandlestickGraph
The code below is the source for this graph.
<?php
// CandlestickGraph
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' => '#111',
'axis_overlap' => 2,
'grid_colour' => '#999',
'label_colour' => '#000',
'axis_font' => 'Arial',
'axis_font_size' => 10,
'pad_right' => 20,
'pad_left' => 20,
'minimum_grid_spacing' => 20,
'show_subdivisions' => true,
'show_grid_subdivisions' => true,
'grid_subdivision_colour' => '#ccc',
'structured_data' => true,
'structure' => [
'key' => 0, 'value' => 1, 'open' => 2, 'high' => 3, 'low' => 4
],
'bar_space' => 15,
];
$width = 300;
$height = 200;
$type = 'CandlestickGraph';
$values = [
['10:00', 30, 50, 55, 24],
['11:00', 50, 30, 55, 28],
['12:00', 40, 50, 59, 39],
['13:00', 25, 40, 62, 21],
['14:00', 45, 25, 55, 21],
['15:00', 72, 45, 75, 41],
['16:00', 96, 72, 99, 64],
];
$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $settings);
$graph->colourRangeHexHSL(0, '#338', '#88c');
$graph->colourRangeHexHSL(1, '#c30', '#c66');
$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.