8. Fading labels
The code below is the source for this graph.
<?php
// 8. Fading labels
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'back_colour' => '#eee',
'back_stroke_width' => 0,
'back_stroke_colour' => '#eee',
'show_data_labels' => true,
'data_label_space' => 5,
'marker_size' => 3,
'bar_space' => 1,
'group_space' => 0,
'show_tooltips' => false,
'axis_font_size' => 12,
'data_label_type' => 'bubble',
'data_label_padding' => 6,
'data_label_round' => 3,
'axis_max_v' => 10,
'data_label_back_colour' => NULL,
'data_label_fill' => [
['#f99','#fff','#f99','h'],
['#99f','#fff','#99f','h'],
],
'data_label_fade_in_speed' => 40,
'data_label_fade_out_speed' => 5,
];
$values = [
[4, 2, 1, 2, 2, 4, 5, 6, 5, 4, 3, 2, 2, 3, 4, 5, 5, 4, 2, 3, 4, 8, 4],
[5, 6, 7, 6, 4, 6, 7, 4, 7, 4, 7, 4, 7, 3, 6, 6, 3, 7, 3, 3, 6, 6, 4],
];
$type = 'BarGraph';
$w = 300;
$graph = new Goat1000\SVGGraph\SVGGraph($w, 200, $settings);
$graph->values($values);
$graph->colourRangeHexHSL(0, '#f33', '#f3f');
$graph->colourRangeHexHSL(1, '#36f', '#3ff');
$graph->colourRangeHexHSL(2, '#fc0', '#fff');
$graph->colourRangeHexHSL(3, '#0f0', '#393');
$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.