| @@ -68,66 +68,8 @@ | ||
| 68 | 68 | $svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />'; |
| 69 | 69 | |
| 70 | 70 | $svg .= '</g></svg>'; |
| 71 | 71 | } |
| 72 | - else if ($type=='3') { | |
| 73 | - ///////////////////////////////////////////////////////////////////////////////////// | |
| 74 | - ///////// CUSTOM <meter type="2"> | |
| 75 | - ///////////////////////////////////////////////////////////////////////////////////// | |
| 76 | - $h = 10; | |
| 77 | - $w = 100; | |
| 78 | - $border_radius = 0.143; // Factor of Height | |
| 79 | - | |
| 80 | - $svg = '<?xml version="1.0" encoding="UTF-8"?> | |
| 81 | - <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
| 82 | - <svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g> | |
| 83 | - | |
| 84 | - | |
| 85 | - <defs> | |
| 86 | - <linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox"> | |
| 87 | - <stop offset="0%" stop-color="rgb(222, 222, 222)" /> | |
| 88 | - <stop offset="20%" stop-color="rgb(232, 232, 232)" /> | |
| 89 | - <stop offset="25%" stop-color="rgb(232, 232, 232)" /> | |
| 90 | - <stop offset="100%" stop-color="rgb(182, 182, 182)" /> | |
| 91 | - </linearGradient> | |
| 92 | - | |
| 93 | - </defs> | |
| 94 | -'; | |
| 95 | - $svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="#f4f4f4" stroke="none" />'; | |
| 96 | - | |
| 97 | - // LOW to HIGH region | |
| 98 | - if ($low && $high && ($low != $min || $high != $max)) { | |
| 99 | - //if ($low && $high) { | |
| 100 | - $barx = (($low-$min) / ($max-$min) ) * $w; | |
| 101 | - $barw = (($high-$low) / ($max-$min) ) * $w; | |
| 102 | - $svg .= '<rect x="'.$barx.'" y="0" width="'.$barw.'" height="'.$h.'" fill="url(#GrGRAY)" stroke="#888888" stroke-width="0.5px" />'; | |
| 103 | - } | |
| 104 | - | |
| 105 | - // OPTIMUM Marker (? AVERAGE) | |
| 106 | - if ($optimum) { | |
| 107 | - $barx = (($optimum-$min) / ($max-$min) ) * $w; | |
| 108 | - $barw = $h/2; | |
| 109 | - $barcol = '#888888'; | |
| 110 | - $svg .= '<rect x="'.$barx.'" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />'; | |
| 111 | - } | |
| 112 | - | |
| 113 | - // VALUE Marker | |
| 114 | - if ($value) { | |
| 115 | - if ($min != $low && $value < $low) { $col = 'orange'; } | |
| 116 | - else if ($max != $high && $value > $high) { $col = 'orange'; } | |
| 117 | - else { $col = 'orange'; } | |
| 118 | - $cx = (($value-$min) / ($max-$min) ) * $w; | |
| 119 | - $cy = $h/2; | |
| 120 | - $rx = $h/2.2; | |
| 121 | - $ry = $h/2.2; | |
| 122 | - $svg .= '<ellipse fill="'.$col.'" stroke="#000000" stroke-width="0.5px" cx="'.$cx.'" cy="'.$cy.'" rx="'.$rx.'" ry="'.$ry.'"/>'; | |
| 123 | - } | |
| 124 | - | |
| 125 | - // BoRDER | |
| 126 | - $svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />'; | |
| 127 | - | |
| 128 | - $svg .= '</g></svg>'; | |
| 129 | - } | |
| 130 | 72 | else { |
| 131 | 73 | ///////////////////////////////////////////////////////////////////////////////////// |
| 132 | 74 | ///////// DEFAULT <meter> |
| 133 | 75 | ///////////////////////////////////////////////////////////////////////////////////// |