Commit 3b327bab by Torkel Ödegaard

Fixes to maxDataPoints / resolution and time axis formats

parent a50b594a
......@@ -257,25 +257,22 @@ function (angular, $, kbn, moment, _) {
}
function time_format(interval, ticks, min, max) {
var _int = kbn.interval_to_seconds(interval);
if(_int >= 2628000) {
return "%Y-%m";
if (min && max && ticks) {
var secPerTick = ((max - min) / ticks) / 1000;
if (secPerTick <= 45) {
return "%H:%M:%S";
}
if(_int >= 10000) {
return "%m/%d";
if (secPerTick <= 3600) {
return "%H:%M";
}
if(_int >= 3600) {
if (secPerTick <= 80000) {
return "%m/%d %H:%M";
}
if(_int >= 700) {
return "%a %H:%M";
}
if (min && max && ticks) {
var msPerTick = (max - min) / ticks;
if (msPerTick <= 45000) {
return "%H:%M:%S";
if (secPerTick <= 2419200) {
return "%m/%d";
}
return "%Y-%m";
}
return "%H:%M";
......
......@@ -230,8 +230,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope.updateTimeRange = function () {
$scope.range = filterSrv.timeRange();
$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';
if ($scope.range) {
......
......@@ -71,13 +71,13 @@ API.txt for details.
switch (c) {
case 'a': c = "" + dayNames[d.getDay()]; 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 'h': // For back-compat with 0.7; remove in 1.0
case 'H': c = leftPad(hours); break;
case 'I': 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;
// quarters not in Open Group's strftime specification
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