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 (min && max && ticks) {
if(_int >= 2628000) { var secPerTick = ((max - min) / ticks) / 1000;
return "%Y-%m";
if (secPerTick <= 45) {
return "%H:%M:%S";
} }
if(_int >= 10000) { if (secPerTick <= 3600) {
return "%m/%d"; return "%H:%M";
} }
if(_int >= 3600) { if (secPerTick <= 80000) {
return "%m/%d %H:%M"; return "%m/%d %H:%M";
} }
if(_int >= 700) { if (secPerTick <= 2419200) {
return "%a %H:%M"; return "%m/%d";
}
if (min && max && ticks) {
var msPerTick = (max - min) / ticks;
if (msPerTick <= 45000) {
return "%H:%M:%S";
} }
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':
......
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