Changeset 6e38cf9e84a86eb270d944e0dc87c551cbc1e965 for ui/web/htdocs
- Timestamp:
- 10/11/08 17:31:59 (5 years ago)
- git-parent:
- Files:
-
- ui/web/htdocs/graph_panel.inc (modified) (6 diffs)
- ui/web/htdocs/json_graph_flot.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ui/web/htdocs/graph_panel.inc
rac2e836 r6e38cf9 43 43 if(recurse > 0) return; 44 44 var str = JSON.stringify(graphinfo); 45 //$("#payload").html(str);45 $("#payload").html(str); 46 46 $.post("json/graph/store", 47 47 {'json':str}, … … 74 74 update_current_graph(true); 75 75 } 76 function gtool_add_guide() { 77 var d = {}; 78 d.metric_type = 'guide'; 79 graphinfo.datapoints.push(d); 80 gtool_add_datapoint(d); 81 update_current_graph(true); 82 } 83 76 84 function gtool_add_datapoint(d) { 77 var o = $("#datapointeditor").clone(); 85 var o; 86 if(d.metric_type == 'guide') { 87 o = $("#guideeditor").clone(); 88 } 89 else { 90 o = $("#datapointeditor").clone(); 91 } 78 92 recurse++; 79 93 … … 227 241 $("#gtool-error").fadeOut("slow"); 228 242 }); 243 $("span.addGuide").click(function() { 244 gtool_add_guide(); 245 }); 229 246 set_current_graph_id(''); 230 247 }); … … 276 293 277 294 </div> 295 <div style="float:right"><span class="addGuide">Add Guide</span></div> 296 <br style="clear:right" /> 278 297 <div class="error"><p class="error" id="gtool-error"></p></div> 279 298 <table id="gtool"> … … 295 314 <form id="hiddeneditor"> 296 315 <table> 316 <tbody id="guideeditor"> 317 <tr> 318 <td><input name="view" type="checkbox" value="1"/></td> 319 <td class="data datatitle"></td> 320 <td></td> 321 <td></td> 322 <td></td> 323 <td><a href="#" class="deletedatapoint"><span>delete</span></a></td> 324 <td class="math">math</td> 325 </tr> 326 <tr class="mathbox"> 327 <td colspan="7"> 328 <div> 329 <label for="math">Display Math</label> <input name="math1" type="text" value="" style="width:380px;" /> 330 </div> 331 <div> 332 <label for="math">Percentile</label> <input name="math2" type="text" value="" style="width:380px;" /> 333 </div> 334 </td> 335 </tr> 336 </tbody> 297 337 <tbody id="datapointeditor"> 298 338 <tr> … … 308 348 <td colspan="7"> 309 349 <div> 310 <label for="math"> Units conversion</label> <input name="math1" type="text" value="" style="width:380px;" />350 <label for="math">Display Math</label> <input name="math1" type="text" value="" style="width:380px;" /> 311 351 </div> 312 352 <div> 313 <label for="math"> Math</label> <input name="math2" type="text" value="" style="width:380px;" />353 <label for="math">Source Math</label> <input name="math2" type="text" value="" style="width:380px;" /> 314 354 </div> 315 355 </td> ui/web/htdocs/json_graph_flot.php
rac2e836 r6e38cf9 18 18 $graph = json_decode($row['json'], true); 19 19 20 foreach($graph['datapoints'] as $d) { 21 if($d['metric_type'] == 'guide') { 22 $driver->calcPercentile($d['math2']); 23 } 24 } 25 20 26 $i = 0; 21 27 $autounits = 0; 22 28 foreach($graph['datapoints'] as $d) { 23 $settings = $graph_settings[$i++]; 24 if($d['hidden'] == "true") $settings['hidden'] = "true"; 25 if($d['math1']) $settings['expression'] = $d['math1']; 26 $settings['axis'] = ($d['axis'] == 'l') ? 'left' : 'right'; 27 $settings['title'] = $d['name']; 28 if($d['metric_type'] == 'numeric') { 29 $driver->addDataSet($d['sid'], $d['metric_name'], 30 $d['derive'], $d['math2'], $settings); 29 if($d['metric_type'] == 'guide') { 30 $color = isset($d['color']) ? $d['color'] : '#ff0000'; 31 $driver->addPercentileGuide($d['name'], $d['math2'], 32 array('expression' => $d['math1'], 33 'color' => $color)); 31 34 } 32 else 33 $driver->addChangeSet($d['sid'], $d['metric_name']); 35 else { 36 $settings = $graph_settings[$i++]; 37 if($d['hidden'] == "true") $settings['hidden'] = "true"; 38 if($d['math1']) $settings['expression'] = $d['math1']; 39 $settings['axis'] = ($d['axis'] == 'l') ? 'left' : 'right'; 40 $settings['title'] = $d['name']; 41 if($d['metric_type'] == 'numeric') { 42 $driver->addDataSet($d['sid'], $d['metric_name'], 43 $d['derive'], $d['math2'], $settings); 44 } 45 else 46 $driver->addChangeSet($d['sid'], $d['metric_name'], $settings); 47 } 34 48 } 35 49
