mirror of
https://github.com/grafana/grafana.git
synced 2025-01-27 00:37:04 -06:00
Added millisecond detection in series
This commit is contained in:
parent
2db62a211a
commit
77f6449db9
@ -168,4 +168,14 @@ export default class TimeSeries {
|
||||
formatValue(value) {
|
||||
return this.valueFormater(value, this.decimals, this.scaledDecimals);
|
||||
}
|
||||
|
||||
isMsResolutionNeeded() {
|
||||
for (var j = 0; j<this.datapoints.length; j++) {
|
||||
var timestamp = this.datapoints[j][1].toString();
|
||||
if (timestamp.length === 13 && parseInt(timestamp.substring(10,13)) !== 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,13 @@ function ($) {
|
||||
var plot = elem.data().plot;
|
||||
var plotData = plot.getData();
|
||||
var seriesList = getSeriesFn();
|
||||
var group, value, absoluteTime, relativeTime, hoverInfo, i, series, seriesHtml;
|
||||
var group, value, absoluteTime, relativeTime, hoverInfo, i, series, seriesHtml, tooltipFormat;
|
||||
|
||||
if (panel.tooltip.msResolution) {
|
||||
tooltipFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
|
||||
} else {
|
||||
tooltipFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||
}
|
||||
|
||||
if (dashboard.sharedCrosshair) {
|
||||
ctrl.publishAppEvent('setCrosshair', { pos: pos, scope: scope });
|
||||
@ -127,7 +133,7 @@ function ($) {
|
||||
seriesHtml = '';
|
||||
|
||||
relativeTime = dashboard.getRelativeTime(seriesHoverInfo.time);
|
||||
absoluteTime = dashboard.formatDate(seriesHoverInfo.time);
|
||||
absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat);
|
||||
|
||||
for (i = 0; i < seriesHoverInfo.length; i++) {
|
||||
hoverInfo = seriesHoverInfo[i];
|
||||
@ -164,7 +170,7 @@ function ($) {
|
||||
value = series.formatValue(value);
|
||||
|
||||
relativeTime = dashboard.getRelativeTime(item.datapoint[0]);
|
||||
absoluteTime = dashboard.formatDate(item.datapoint[0]);
|
||||
absoluteTime = dashboard.formatDate(item.datapoint[0], tooltipFormat);
|
||||
|
||||
group += '<div class="graph-tooltip-value">' + value + '</div>';
|
||||
|
||||
|
@ -69,6 +69,7 @@ var panelDefaults = {
|
||||
tooltip : {
|
||||
value_type: 'cumulative',
|
||||
shared: true,
|
||||
msResolution: false,
|
||||
},
|
||||
// time overrides
|
||||
timeFrom: null,
|
||||
@ -200,6 +201,8 @@ class GraphCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
this.datapointsCount += datapoints.length;
|
||||
|
||||
this.panel.tooltip.msResolution = this.panel.tooltip.msResolution || series.isMsResolutionNeeded();
|
||||
}
|
||||
|
||||
return series;
|
||||
|
Loading…
Reference in New Issue
Block a user