5 class Progress
extends Meter
7 protected function makeSVG($type, $value, $max, $min, $optimum, $low, $high)
12 /////////////////////////////////////////////////////////////////////////////////////
13 ///////// CUSTOM <progress type="2">
14 /////////////////////////////////////////////////////////////////////////////////////
16 /////////////////////////////////////////////////////////////////////////////////////
17 ///////// DEFAULT <progress>
18 /////////////////////////////////////////////////////////////////////////////////////
21 $border_radius = 0.143; // Factor of Height
23 if ($value or $value === '0') {
24 $fill = 'url(#GrGRAY)';
29 $svg = '<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '"><g>
32 <linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
33 <stop offset="0%" stop-color="rgb(222, 222, 222)" />
34 <stop offset="20%" stop-color="rgb(232, 232, 232)" />
35 <stop offset="25%" stop-color="rgb(232, 232, 232)" />
36 <stop offset="100%" stop-color="rgb(182, 182, 182)" />
39 <linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
40 <stop offset="0%" stop-color="rgb(102, 230, 102)" />
41 <stop offset="20%" stop-color="rgb(218, 255, 218)" />
42 <stop offset="25%" stop-color="rgb(218, 255, 218)" />
43 <stop offset="100%" stop-color="rgb(0, 148, 0)" />
48 <rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="' . $fill . '" stroke="none" />
52 $barw = (($value - $min) / ($max - $min) ) * $w;
53 $barcol = 'url(#GrGREEN)';
54 $svg .= '<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $barw . '" height="' . $h . '" fill="' . $barcol . '" stroke="none" />';
59 $svg .= '<rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="none" stroke="#888888" stroke-width="0.5px" />';
61 // $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';