Changeset 10022
- Timestamp:
- 11/23/14 18:52:44 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/webif/graph/graph.svg
r10000 r10022 5 5 height='100%' 6 6 viewBox='0 0 800 400' 7 preserveAspectRatio=' YMid'7 preserveAspectRatio='XMaxYMid' 8 8 onload='init(evt)' 9 9 class='graph' > 10 <title>##HTTPOSCAMLABEL## r##CS_SVN_VERSION## (ECM Graph)</title> 10 11 <g id='graph' > 11 <rect id='g' class='graph_bg' x 1='0' y1='0' width='800' height='400' />12 <rect id='g' class='graph_bg' x='0' y='0' width='800' height='400' /> 12 13 <text id='graph_error' class='graph_error' x='400' y='125' visibility='hidden'>Error occured!</text> 13 <path id='graph_grid' class='graph_grid' d='M 2 1 05 L 798 105 M 2 180 L 798 180 M 2 255 L 798 255 M 2 330 L 798 330'/>14 <path id='graph_grid' class='graph_grid' d='M 2 125 L 798 125 M 2 200 L 798 200 M 2 275 L 798 275 M 2 350 L 798 350'/> 14 15 15 16 <rect id='graph_grid_button_back' class='graph_button' cursor='pointer' x='425' y='5' rx='5' ry='5' width='40' height='20'/> … … 18 19 <rect id='graph_grid_button' style='opacity:0;' cursor='pointer' x='340' y='5' rx='5' ry='5' width='130' height='20'/> 19 20 20 <text id='graph_grid_txt 4' class='graph_grid_txt' x='798' y='328'>-</text>21 <text id='graph_grid_txt 3' class='graph_grid_txt' x='798' y='253'>-</text>22 <text id='graph_grid_txt 2' class='graph_grid_txt' x='798' y='178'>-</text>23 <text id='graph_grid_txt 1' class='graph_grid_txt' x='798' y='103'>-</text>21 <text id='graph_grid_txt1' class='graph_grid_txt' x='798' y='123'>-</text> 22 <text id='graph_grid_txt2' class='graph_grid_txt' x='798' y='198'>-</text> 23 <text id='graph_grid_txt3' class='graph_grid_txt' x='798' y='273'>-</text> 24 <text id='graph_grid_txt4' class='graph_grid_txt' x='798' y='348'>-</text> 24 25 </g> 25 26 <script type='text/ecmascript'> … … 184 185 } else { 185 186 newText.setAttributeNS(null,'y',13+(10*i)); 186 newText.setAttributeNS(null,'style','');187 187 } 188 188 var textNode = document.createTextNode(plots[i]['name']); 189 189 newText.appendChild(textNode); 190 190 document.getElementById('graph').appendChild(newText); 191 191 } … … 214 214 } 215 215 var rmax=makeRoundMax(max); 216 var height = 3 29;217 var scale = height/ rmax;216 var height = 350; 217 var scale = (height-50) / rmax; 218 218 i=0; 219 219 while (i < plots.length) { 220 220 var plot = plots[i]['data']; 221 var path = 'M 2 ' + (height - (plot[0] * scale));222 for (b = 2; b < plot.length; b++) {221 var path = 'M 2 '+ (plot[0] > 0 ? Math.round((height - (plot[0] * scale))*10)/10 : height); 222 for (b = 3; b < plot.length; b++) { 223 223 var x = step * b; 224 var y_in = height - (plot[b] * scale);224 var y_in = plot[b] > 0 ? Math.round((height - (plot[b] * scale))*10)/10 : height; 225 225 path += ' L' + x + ' ' + y_in; 226 226 } … … 228 228 i++; 229 229 } 230 SVGDoc.getElementById('graph_grid_txt1').firstChild.data = 3*rmax/4 + 'ms' 230 SVGDoc.getElementById('graph_grid_txt1').firstChild.data = 3*rmax/4 + 'ms'; 231 231 SVGDoc.getElementById('graph_grid_txt2').firstChild.data = 2*rmax/4 + 'ms'; 232 232 SVGDoc.getElementById('graph_grid_txt3').firstChild.data = rmax/4 + 'ms'; 233 SVGDoc.getElementById('graph_grid_txt4').firstChild.data = '0ms' 233 SVGDoc.getElementById('graph_grid_txt4').firstChild.data = '0ms'; 234 234 SVGDoc.getElementById('graph_error').setAttributeNS(null, 'visibility', 'hidden'); 235 235 } 236 236 function makeRoundMax(max) { 237 rmax = 100 0;237 rmax = 100; 238 238 i = 0; 239 239 while (max > rmax) { … … 244 244 rmax *= 2; 245 245 } 246 if (i == 8) rmax *= 1.000;247 246 } 248 247 return rmax; 249 } 248 } 250 249 function handle_error() { 251 250 SVGDoc.getElementById('graph_error').setAttributeNS(null, 'visibility', 'visible');
Note:
See TracChangeset
for help on using the changeset viewer.