Changeset fb2f0f75ce45f4bf8e9bf60cb6cf505976bca9ff
- Timestamp:
- 10/06/08 18:51:41
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1223319101 +0000
- git-parent:
[646f05152343c6ecf678db40bf4debef24b65815]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1223319101 +0000
- Message:
more progress... worksheet prototyping, no data backend yet, refs #22
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r648b048 |
rfb2f0f7 |
|
| 3 | 3 | RewriteRule ^json/ds/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ datapoint_browse_json.php?l1=$1&l2=$2&l3=$3&l4=$4 [PT,QSA] |
|---|
| 4 | 4 | RewriteRule ^json/ds/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ datapoint_browse_json.php?l1=$1&l2=$2&l3=$3&l4=$4&l5=$5 [PT,QSA] |
|---|
| | 5 | RewriteRule ^json/worksheet/info/([^/]*)$ worksheet_info.php?id=$1 [PT,QSA] |
|---|
| 5 | 6 | RewriteRule ^json/graph/info/([^/]*)$ graph_info.php?id=$1 [PT,QSA] |
|---|
| 6 | 7 | RewriteRule ^json/graph/store$ graph_store.php [PT,QSA] |
|---|
| r90b4360 |
rfb2f0f7 |
|
| 43 | 43 | z-index:200; |
|---|
| 44 | 44 | } |
|---|
| 45 | | #container{position:absolute;top:38px;left:0;overflow:auto;width:100%;z-index:100;} |
|---|
| | 45 | #container{position:absolute;top:38px;left:0px;padding:1em;overflow:auto;z-index:100;} |
|---|
| 46 | 46 | #content { |
|---|
| 47 | 47 | background:#FFF; |
|---|
| … | … | |
| 248 | 248 | #graphlist ul li ul li a em{color:#82787b;padding-left:3px;} |
|---|
| 249 | 249 | |
|---|
| | 250 | div.plot-area { height: 180px; width: 380px; } |
|---|
| | 251 | div.plot-area div.centered{ |
|---|
| | 252 | height: 180px; width: 380px; |
|---|
| | 253 | display: table-cell;vertical-align:middle;text-align:center; |
|---|
| | 254 | } |
|---|
| | 255 | div.plot-area div.centered .loading { |
|---|
| | 256 | background:url(../images/jquery-ajax-loader.gif) top center no-repeat; |
|---|
| | 257 | height:25px;width:380px; |
|---|
| | 258 | } |
|---|
| | 259 | |
|---|
| | 260 | div.plot-legend table { height: 4em; } |
|---|
| | 261 | div.plot-legend td.legendLabel { padding: 0 0.5em; } |
|---|
| | 262 | |
|---|
| 250 | 263 | /* worksheet list */ |
|---|
| 251 | 264 | #worksheetlist {height:450px;overflow:auto;} |
|---|
| … | … | |
| 254 | 267 | #worksheetlist ul li a {background:url(../images/icon-worksheet.png) 0 1px no-repeat;padding-left:15px;} |
|---|
| 255 | 268 | #worksheetlist ul li.selected {background:#e6e4e5 /*url(../images/icon-worksheet.png) 0 3px no-repeat*/;display:block;} |
|---|
| | 269 | |
|---|
| | 270 | ul#worksheet-graphs { |
|---|
| | 271 | } |
|---|
| | 272 | ul#worksheet-graphs li { |
|---|
| | 273 | float:left; |
|---|
| | 274 | list-style:none; |
|---|
| | 275 | margin:1.5em 1em 0 0; |
|---|
| | 276 | } |
|---|
| 256 | 277 | |
|---|
| 257 | 278 | /******* GRAPH CONTROLS *******/ |
|---|
| r646f051 |
rfb2f0f7 |
|
| 12 | 12 | } |
|---|
| 13 | 13 | var recurse = 0; |
|---|
| 14 | | function plot_id(r) { |
|---|
| 15 | | var placeholder = $("#maingraph > div.plot-area"); |
|---|
| | 14 | function plot_id(r, domid) { |
|---|
| | 15 | var placeholder = $(domid + " > div.plot-area"); |
|---|
| 16 | 16 | placeholder.bind("plotselected", function (event, ranges) { |
|---|
| | 17 | alert(ranges.xaxis.from + " -> " + ranges.xaxis.to); |
|---|
| 17 | 18 | plot = $.plot(placeholder, data, |
|---|
| 18 | 19 | $.extend(true, {}, options, { |
|---|
| … | … | |
| 20 | 21 | })); |
|---|
| 21 | 22 | }); |
|---|
| 22 | | r.options.legend.container = $("#maingraph div.plot-legend"); |
|---|
| | 23 | r.options.legend.container = $(domid + " div.plot-legend"); |
|---|
| | 24 | if(!r.options.yaxis) r.options.yaxis = {}; |
|---|
| | 25 | if(r.options.yaxis.suffix) |
|---|
| | 26 | r.options.yaxis.tickFormatter = function (val, axis) { |
|---|
| | 27 | return val.toFixed(axis.tickDecimals) + r.options.yaxis.suffix; |
|---|
| | 28 | }; |
|---|
| 23 | 29 | var plot = $.plot(placeholder, r.data, r.options); |
|---|
| 24 | 30 | } |
|---|
| 25 | | function redraw_current_graph() { |
|---|
| | 31 | function redraw_current_graph(domid) { |
|---|
| 26 | 32 | if(graphinfo.datapoints.length > 0) { |
|---|
| 27 | | $("#maingraph").slideDown("normal"); |
|---|
| | 33 | $(domid).slideDown("normal"); |
|---|
| 28 | 34 | var url = "flot/graph/settings/" + graphinfo.id; |
|---|
| 29 | | $.getJSON(url, {'cnt':displayinfo.cnt, 'start':displayinfo.start, 'end':displayinfo.end}, plot_id); |
|---|
| | 35 | $.getJSON(url, {'cnt':displayinfo.cnt, 'start':displayinfo.start, 'end':displayinfo.end}, function (r) { plot_id(r,domid); }); |
|---|
| 30 | 36 | } |
|---|
| 31 | 37 | else { |
|---|
| 32 | | $("#maingraph").slideUp("normal"); |
|---|
| | 38 | $(domid).slideUp("normal"); |
|---|
| 33 | 39 | } |
|---|
| 34 | 40 | } |
|---|
| … | … | |
| 56 | 62 | }); |
|---|
| 57 | 63 | } |
|---|
| 58 | | if(redraw) redraw_current_graph(); |
|---|
| | 64 | if(redraw) redraw_current_graph("#maingraph"); |
|---|
| 59 | 65 | if(f) f(d); |
|---|
| 60 | 66 | }, 'json'); |
|---|
| … | … | |
| 146 | 152 | gtool_add_datapoint(graphinfo.datapoints[i]); |
|---|
| 147 | 153 | } |
|---|
| 148 | | redraw_current_graph(); |
|---|
| | 154 | redraw_current_graph("#maingraph"); |
|---|
| 149 | 155 | } |
|---|
| 150 | 156 | function fetch_graph_info(id) { |
|---|
| … | … | |
| 189 | 195 | displayinfo.end = ''; |
|---|
| 190 | 196 | $(this).addClass("selected"); |
|---|
| 191 | | redraw_current_graph(); |
|---|
| | 197 | redraw_current_graph("#maingraph"); |
|---|
| 192 | 198 | return false; |
|---|
| 193 | 199 | }); |
|---|
| … | … | |
| 207 | 213 | displayinfo.start = start.toUTCString(); |
|---|
| 208 | 214 | displayinfo.end = end.toUTCString(); |
|---|
| 209 | | redraw_current_graph(); |
|---|
| | 215 | redraw_current_graph("#maingraph"); |
|---|
| 210 | 216 | $('#range a.btn-slide').get(0).innerHTML = formated.join(' - '); |
|---|
| 211 | 217 | } |
|---|
| r646f051 |
rfb2f0f7 |
|
| 39 | 39 | $(".accordion span:last").slideDown(); |
|---|
| 40 | 40 | |
|---|
| | 41 | $("div#container div").eq(1).slideUp(); |
|---|
| | 42 | $("div#container div:last").slideDown(); |
|---|
| | 43 | |
|---|
| 41 | 44 | $(".accordion h3").click(function(){ |
|---|
| 42 | 45 | $(this).next("span").slideToggle("normal") |
|---|
| … | … | |
| 44 | 47 | $(this).toggleClass("active"); |
|---|
| 45 | 48 | $(this).siblings("h3").removeClass("active"); |
|---|
| | 49 | $(this).siblings("h3").each(function(e) { |
|---|
| | 50 | $("#" + $(this).attr("id") + "_panel").slideUp("fast"); |
|---|
| | 51 | }); |
|---|
| | 52 | if($(this).hasClass("active")) |
|---|
| | 53 | $("#" + $(this).attr("id") + "_panel").slideDown("fast"); |
|---|
| | 54 | else |
|---|
| | 55 | $("#" + $(this).attr("id") + "_panel").slideUp("fast"); |
|---|
| 46 | 56 | }); |
|---|
| 47 | 57 | |
|---|
| … | … | |
| 96 | 106 | <!-- alert / Remove this when new script is made --> |
|---|
| 97 | 107 | <script type="text/javascript"> |
|---|
| 98 | | function disp_alert() |
|---|
| 99 | | { |
|---|
| 100 | | alert("display the correct graph") |
|---|
| 101 | | } |
|---|
| 102 | 108 | function MM_jumpMenu(targ,selObj,restore){ //v3.0 |
|---|
| 103 | 109 | eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); |
|---|
| … | … | |
| 124 | 130 | <div id="container"> |
|---|
| 125 | 131 | <div id="content"> |
|---|
| 126 | | <div id="tab_content"> |
|---|
| 127 | | <ul> |
|---|
| 128 | | <li><a href="#" class="selected">Graph Panel</a></li> |
|---|
| 129 | | <li><a href="#">Worksheet</a></li> |
|---|
| 130 | | </ul><div style="clear:both;"></div> |
|---|
| 131 | | </div> |
|---|
| 132 | | <!-- graph and controls --> |
|---|
| 133 | | <div id="main"> |
|---|
| | 132 | <div id="worksheet_controls_panel"> |
|---|
| | 133 | <?php include('worksheet_panel.inc') ?> |
|---|
| | 134 | </div><!-- end main --> |
|---|
| | 135 | <div id="graph_controls_panel"> |
|---|
| 134 | 136 | <?php include('graph_controls.inc') ?> |
|---|
| 135 | 137 | </div><!-- end main --> |
|---|
| r646f051 |
rfb2f0f7 |
|
| 42 | 42 | $options = array( |
|---|
| 43 | 43 | 'xaxis' => array ( 'mode' => 'time' ), |
|---|
| 44 | | 'legend' => array ( 'noColumns' => 4, position => 'sw' ), |
|---|
| | 44 | 'yaxis' => array ( 'suffix' => $driver->autounit() . '' ), |
|---|
| | 45 | 'legend' => array ( 'noColumns' => 6, position => 'sw' ), |
|---|
| 45 | 46 | 'selection' => array ( 'mode' => 'x' ), |
|---|
| 46 | 47 | 'shadowSize' => 0, |
|---|
| … | … | |
| 51 | 52 | 'options' => $options, |
|---|
| 52 | 53 | 'title' => $driver->title() . '', |
|---|
| 53 | | 'suffix' => $driver->autounit() . '' |
|---|
| 54 | 54 | )); |
|---|
| 55 | 55 | |
|---|
| r2a9ba1d |
rfb2f0f7 |
|
| 1 | | <h3>Search Data</h3> |
|---|
| | 1 | <h3 id="graph_controls">Graph Controls</h3> |
|---|
| 2 | 2 | <span class="search"> |
|---|
| 3 | 3 | <div class="tabs"> |
|---|
| r2a9ba1d |
rfb2f0f7 |
|
| 1 | | <h3>Worksheet Controls</h3> |
|---|
| | 1 | <h3 id="worksheet_controls">Worksheet Controls</h3> |
|---|
| 2 | 2 | <span class="worksheet"> |
|---|
| 3 | 3 | <div id="searchform" style="margin:1em 0 1em 0;padding-bottom:1em;border-bottom: solid 1px #c4c4c4;"> |
|---|
| r90b4360 |
rfb2f0f7 |
|
| 101 | 101 | using (sid,metric_name,metric_type) |
|---|
| 102 | 102 | where ts_search_all @@ to_tsquery(query)))", |
|---|
| 103 | | "select graphid, title, |
|---|
| | 103 | "select graphid, title, json, |
|---|
| 104 | 104 | to_char(last_update, 'YYYY/mm/dd') as last_update |
|---|
| 105 | 105 | from prism.saved_graphs, |
|---|
| … | … | |
| 242 | 242 | return $rv; |
|---|
| 243 | 243 | } |
|---|
| 244 | | function percentile($arr, $p, $attr = 'avg_value') { |
|---|
| | 244 | function percentile($arr, $p, $groupname = 'left', $attr = 'avg_value') { |
|---|
| 245 | 245 | // This sums the sets and returns the XX percentile bucket. |
|---|
| 246 | 246 | if(!is_array($arr)) return array(); |
|---|
| … | … | |
| 251 | 251 | $nonnull = 0; |
|---|
| 252 | 252 | foreach ($arr as $sets) { |
|---|
| | 253 | if($sets->groupname() != $groupname) continue; |
|---|
| 253 | 254 | $value = $sets->data($ts, $attr); |
|---|
| 254 | 255 | if($value != "") $nonnull = 1; |
|---|
| r72d0010 |
rfb2f0f7 |
|
| 45 | 45 | new Reconnoiter_DataSet($uuid, $name, $derive, $expr, |
|---|
| 46 | 46 | $this->start(), $this->end(), $this->cnt()); |
|---|
| | 47 | $this->sets["$uuid-$name"]->groupname($attrs['axis']); |
|---|
| 47 | 48 | $this->sets_config["$uuid-$name"] = is_array($attrs) ? $attrs : array(); |
|---|
| 48 | 49 | if(!isset($this->master_set)) $this->master_set = $this->sets["$uuid-$name"]; |
|---|
| … | … | |
| 92 | 93 | switch($this->units) { |
|---|
| 93 | 94 | case 0.000000001: return 'n'; |
|---|
| | 95 | case '1.0E-6': |
|---|
| 94 | 96 | case 0.000001: return 'u'; |
|---|
| 95 | 97 | case 0.001: return 'm'; |
|---|
| rdf2e366 |
rfb2f0f7 |
|
| 6 | 6 | public $data; |
|---|
| 7 | 7 | protected $expr; |
|---|
| | 8 | protected $groupname; |
|---|
| 8 | 9 | function __construct($uuid, $name, $derive, $expr, $start, $end, $cnt = 400) { |
|---|
| 9 | 10 | $db = Reconnoiter_DB::getDB(); |
|---|
| 10 | 11 | $this->data = $db->get_data_for_window($uuid, $name, $start, $end, $cnt, $derive); |
|---|
| 11 | 12 | $this->expr = $expr; |
|---|
| | 13 | } |
|---|
| | 14 | function groupname($gn = null) { |
|---|
| | 15 | if(isset($gn)) $this->groupname = $gn; |
|---|
| | 16 | return $this->groupname; |
|---|
| 12 | 17 | } |
|---|
| 13 | 18 | function points() { |
|---|
| r648b048 |
rfb2f0f7 |
|
| 13 | 13 | return parent::defaultChangeSetAttrs($uuid, $name, $derive, $attrs); |
|---|
| 14 | 14 | } |
|---|
| | 15 | function graphcolors() { |
|---|
| | 16 | $c = array(); |
|---|
| | 17 | foreach($this->sets as $name => $set) { |
|---|
| | 18 | $c[] = $this->sets_config[$name]['color']; |
|---|
| | 19 | } |
|---|
| | 20 | foreach($this->guides as $name => $value) { |
|---|
| | 21 | $c[] = $this->guides_config[$name]['color']; |
|---|
| | 22 | } |
|---|
| | 23 | return $c; |
|---|
| | 24 | } |
|---|
| 15 | 25 | function graphdata() { |
|---|
| 16 | 26 | $a = array(); |
|---|
| … | … | |
| 21 | 31 | 'data' => $this->graphdataset($set, $this->sets_config[$name]), |
|---|
| 22 | 32 | 'yaxis' => ($this->sets_config[$name]['axis'] == 'right') ? 2 : 1, |
|---|
| 23 | | 'lines' => array ( 'show' => 'true', 'fill' => '0.8', 'lineWidth' => '1' ) |
|---|
| | 33 | 'lines' => array ( 'show' => 'true', 'fill' => '0.3', 'lineWidth' => '1' ) |
|---|
| 24 | 34 | ); |
|---|
| 25 | 35 | } |
|---|