composer package updates
[openemr.git] / vendor / mpdf / mpdf / src / Tag / Progress.php
blob32e22daa0cff13e2a207dec61d16d6fcab0f99d2
1 <?php
3 namespace Mpdf\Tag;
5 class Progress extends Meter
7 protected function makeSVG($type, $value, $max, $min, $optimum, $low, $high)
9 $svg = '';
11 if ($type == '2') {
12 /////////////////////////////////////////////////////////////////////////////////////
13 ///////// CUSTOM <progress type="2">
14 /////////////////////////////////////////////////////////////////////////////////////
15 } else {
16 /////////////////////////////////////////////////////////////////////////////////////
17 ///////// DEFAULT <progress>
18 /////////////////////////////////////////////////////////////////////////////////////
19 $h = 10;
20 $w = 100;
21 $border_radius = 0.143; // Factor of Height
23 if ($value or $value === '0') {
24 $fill = 'url(#GrGRAY)';
25 } else {
26 $fill = '#f8f8f8';
29 $svg = '<svg width="' . $w . 'px" height="' . $h . 'px" viewBox="0 0 ' . $w . ' ' . $h . '"><g>
31 <defs>
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)" />
37 </linearGradient>
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)" />
44 </linearGradient>
46 </defs>
48 <rect x="0" y="0" rx="' . ($h * $border_radius) . 'px" ry="' . ($h * $border_radius) . 'px" width="' . $w . '" height="' . $h . '" fill="' . $fill . '" stroke="none" />
51 if ($value) {
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" />';
58 // Borders
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" />';
60 if ($value) {
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" />';
65 $svg .= '</g></svg>';
69 return $svg;