Commit 3b327bab by Torkel Ödegaard

Fixes to maxDataPoints / resolution and time axis formats

parent a50b594a
...@@ -257,25 +257,22 @@ function (angular, $, kbn, moment, _) { ...@@ -257,25 +257,22 @@ function (angular, $, kbn, moment, _) {
} }
function time_format(interval, ticks, min, max) { function time_format(interval, ticks, min, max) {
var _int = kbn.interval_to_seconds(interval);
if(_int >= 2628000) {
return "%Y-%m";
}
if(_int >= 10000) {
return "%m/%d";
}
if(_int >= 3600) {
return "%m/%d %H:%M";
}
if(_int >= 700) {
return "%a %H:%M";
}
if (min && max && ticks) { if (min && max && ticks) {
var msPerTick = (max - min) / ticks; var secPerTick = ((max - min) / ticks) / 1000;
if (msPerTick <= 45000) {
if (secPerTick <= 45) {
return "%H:%M:%S"; return "%H:%M:%S";
} }
if (secPerTick <= 3600) {
return "%H:%M";
}
if (secPerTick <= 80000) {
return "%m/%d %H:%M";
}
if (secPerTick <= 2419200) {
return "%m/%d";
}
return "%Y-%m";
} }
return "%H:%M"; return "%H:%M";
......
...@@ -230,8 +230,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -230,8 +230,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope.updateTimeRange = function () { $scope.updateTimeRange = function () {
$scope.range = filterSrv.timeRange(); $scope.range = filterSrv.timeRange();
$scope.rangeUnparsed = filterSrv.timeRange(false); $scope.rangeUnparsed = filterSrv.timeRange(false);
$scope.resolution = ($(window).width() / ($scope.panel.span / 12)) / 2; $scope.resolution = ($(window).width() * ($scope.panel.span / 12)) / 2;
$scope.interval = '10m'; $scope.interval = '10m';
if ($scope.range) { if ($scope.range) {
......
...@@ -71,13 +71,13 @@ API.txt for details. ...@@ -71,13 +71,13 @@ API.txt for details.
switch (c) { switch (c) {
case 'a': c = "" + dayNames[d.getDay()]; break; case 'a': c = "" + dayNames[d.getDay()]; break;
case 'b': c = "" + monthNames[d.getMonth()]; break; case 'b': c = "" + monthNames[d.getMonth()]; break;
case 'd': c = leftPad(d.getDate()); break; case 'd': c = leftPad(d.getDate(), ""); break;
case 'e': c = leftPad(d.getDate(), " "); break; case 'e': c = leftPad(d.getDate(), " "); break;
case 'h': // For back-compat with 0.7; remove in 1.0 case 'h': // For back-compat with 0.7; remove in 1.0
case 'H': c = leftPad(hours); break; case 'H': c = leftPad(hours); break;
case 'I': c = leftPad(hours12); break; case 'I': c = leftPad(hours12); break;
case 'l': c = leftPad(hours12, " "); break; case 'l': c = leftPad(hours12, " "); break;
case 'm': c = leftPad(d.getMonth() + 1); break; case 'm': c = leftPad(d.getMonth() + 1, ""); break;
case 'M': c = leftPad(d.getMinutes()); break; case 'M': c = leftPad(d.getMinutes()); break;
// quarters not in Open Group's strftime specification // quarters not in Open Group's strftime specification
case 'q': case 'q':
...@@ -158,7 +158,7 @@ API.txt for details. ...@@ -158,7 +158,7 @@ API.txt for details.
return makeUtcWrapper(new Date(ts)); return makeUtcWrapper(new Date(ts));
} }
} }
// map of app. size of time units in milliseconds // map of app. size of time units in milliseconds
var timeUnitSize = { var timeUnitSize = {
...@@ -176,9 +176,9 @@ API.txt for details. ...@@ -176,9 +176,9 @@ API.txt for details.
var baseSpec = [ var baseSpec = [
[1, "second"], [2, "second"], [5, "second"], [10, "second"], [1, "second"], [2, "second"], [5, "second"], [10, "second"],
[30, "second"], [30, "second"],
[1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"], [1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],
[30, "minute"], [30, "minute"],
[1, "hour"], [2, "hour"], [4, "hour"], [1, "hour"], [2, "hour"], [4, "hour"],
[8, "hour"], [12, "hour"], [8, "hour"], [12, "hour"],
[1, "day"], [2, "day"], [3, "day"], [1, "day"], [2, "day"], [3, "day"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment