diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js
index 5690b7866ec5e..364d1df7995c5 100644
--- a/src/app/components/kbn.js
+++ b/src/app/components/kbn.js
@@ -238,6 +238,22 @@ function($, _, moment) {
return info.sec * info.count;
};
+ kbn.intervalToDateFormat = function (interval) {
+ var format = "HH:mm
MM-DD";
+ var _int = kbn.interval_to_seconds(interval);
+ if(_int >= 2628000) {
+ format = "YYYY-MM-DD
MMMM";
+ }
+ else if(_int >= 604800) {
+ format = 'YYYY-MM-DD
Wo [week]';
+ }
+ else if(_int >= 86400) {
+ format = 'YYYY-MM-DD
dddd';
+ }
+
+ return format;
+ };
+
// This should go away, moment.js can do this
kbn.time_ago = function(string) {
return new Date(new Date().getTime() - (kbn.interval_to_ms(string)));
@@ -594,4 +610,4 @@ function($, _, moment) {
};
return kbn;
-});
\ No newline at end of file
+});
diff --git a/src/app/panels/histogram/module.js b/src/app/panels/histogram/module.js
index 7493933b57332..2863819353149 100644
--- a/src/app/panels/histogram/module.js
+++ b/src/app/panels/histogram/module.js
@@ -568,6 +568,18 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
});
};
+ var timeFormat = function(val, stripHTML) {
+ var format = kbn.intervalToDateFormat(scope.panel.interval);
+
+ if (stripHTML === true) {
+ format = format.replace(/<(?:.|\n)*?>/gm, ' ');
+ }
+
+ return scope.panel.timezone === 'browser' ?
+ moment(val).format(format) :
+ moment.utc(val).format(format);
+ };
+
// Function for rendering panel
function render_panel(data) {
// IE doesn't work without this
@@ -626,7 +638,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
mode: "time",
min: _.isUndefined(scope.range.from) ? null : scope.range.from.getTime(),
max: _.isUndefined(scope.range.to) ? null : scope.range.to.getTime(),
- timeformat: time_format(scope.panel.interval),
+ tickFormatter: timeFormat,
label: "Datetime",
ticks: elem.width()/100
},
@@ -706,24 +718,9 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
}
}
- function time_format(interval) {
- var _int = kbn.interval_to_seconds(interval);
- if(_int >= 2628000) {
- return "%Y-%m";
- }
- if(_int >= 86400) {
- return "%Y-%m-%d";
- }
- if(_int >= 60) {
- return "%H:%M
%m-%d";
- }
-
- return "%H:%M:%S";
- }
-
var $tooltip = $('