Skip to content

Commit

Permalink
Updated version to milestone pre-2, added configurable auto inteval r…
Browse files Browse the repository at this point in the history
…esolution for issue elastic#70
  • Loading branch information
Rashid Khan committed May 13, 2013
1 parent 906f3a3 commit 8880654
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone 1</small></small></p>
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone pre-2</small></small></p>
<span class="brand">{{dashboards.title}}</span>
<div class="brand"><i class='icon-edit pointer' ng-show='dashboards.editable' bs-modal="'partials/dasheditor.html'"></i></div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion panels/histogram/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<label class="small">Mode</label>
<select ng-change="set_refresh(true)" class="input-small" ng-model="panel.mode" ng-options="f for f in ['count','min','mean','max','total']"></select>
</div>
<div class="span3">
<div class="span3" ng-show="panel.mode != 'count'">
<label class="small">Field</label>
<form>
<input ng-change="set_refresh(true)" placeholder="Start typing" bs-typeahead="fields.list" type="text" class="input-small" ng-model="panel.value_field">
Expand Down Expand Up @@ -75,6 +75,12 @@ <h5>Chart Options</h5>
<div class="span2">
<label class="small">Auto-interval</label><input type="checkbox" ng-model="panel.auto_int" ng-checked="panel.auto_int" />
</div>
<div class="span2" ng-show='panel.auto_int'>
<label class="small">Resolution</label><input type="number" class='input-mini' ng-model="panel.resolution" ng-change='set_refresh(true)'/>
</div>
<div class="span3" ng-show='panel.auto_int'>
<label class="small">Shoot for this many data points, rounding to sane intervals</label>
</div>
<div class="span2" ng-hide='panel.auto_int'>
<label class="small">Interval</label><input type="text" class='input-mini' ng-model="panel.interval" ng-change='set_refresh(true)'/>
</div>
Expand Down
41 changes: 22 additions & 19 deletions panels/histogram/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
this is usually populated by a stringquery panel wher the query and label
parameter are the same
* auto_int :: Auto calculate data point interval?
* resolution :: If auto_int is enables, shoot for this many data points, rounding to
sane intervals
* interval :: Datapoint interval in elasticsearch date math format (eg 1d, 1w, 1y, 5y)
* fill :: Only applies to line charts. Level of area shading from 0-10
* linewidth :: Only applies to line charts. How thick the line should be in pixels
Expand Down Expand Up @@ -43,24 +45,25 @@ angular.module('kibana.histogram', [])

// Set and populate defaults
var _d = {
group : "default",
query : [ {query: "*", label:"Query"} ],
mode : 'count',
value_field: null,
auto_int : true,
interval : '5m',
fill : 3,
linewidth : 3,
timezone : 'browser', // browser, utc or a standard timezone
spyable : true,
zoomlinks : true,
bars : true,
stack : true,
points : false,
lines : false,
legend : true,
'x-axis' : true,
'y-axis' : true,
group : "default",
query : [ {query: "*", label:"Query"} ],
mode : 'count',
value_field : null,
auto_int : true,
resolution : 100,
interval : '5m',
fill : 3,
linewidth : 3,
timezone : 'browser', // browser, utc or a standard timezone
spyable : true,
zoomlinks : true,
bars : true,
stack : true,
points : false,
lines : false,
legend : true,
'x-axis' : true,
'y-axis' : true,
}
_.defaults($scope.panel,_d)

Expand Down Expand Up @@ -107,7 +110,7 @@ angular.module('kibana.histogram', [])
return

if ($scope.panel.auto_int)
$scope.panel.interval = secondsToHms(calculate_interval($scope.time.from,$scope.time.to,50,0)/1000);
$scope.panel.interval = secondsToHms(calculate_interval($scope.time.from,$scope.time.to,$scope.panel.resolution,0)/1000);

$scope.panel.loading = true;
var _segment = _.isUndefined(segment) ? 0 : segment
Expand Down

0 comments on commit 8880654

Please sign in to comment.