Skip to content

Commit ec19a97

Browse files
utkarshcmutorkelo
authored andcommitted
1 parent 9e60565 commit ec19a97

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

public/app/core/time_series2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ export default class TimeSeries {
173173

174174
isMsResolutionNeeded() {
175175
for (var i = 0; i < this.datapoints.length; i++) {
176-
if (this.datapoints[i][0] !== null) {
177-
var timestamp = this.datapoints[i][0].toString();
176+
if (this.datapoints[i][1] !== null) {
177+
var timestamp = this.datapoints[i][1].toString();
178178
if (timestamp.length === 13 && (timestamp % 1000) !== 0) {
179179
return true;
180180
}

public/app/plugins/panel/graph/specs/graph_ctrl_specs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ describe('GraphCtrl', function() {
2222
describe('msResolution with second resolution timestamps', function() {
2323
beforeEach(function() {
2424
var data = [
25-
{ target: 'test.cpu1', datapoints: [[1234567890, 45], [1234567899, 60]]},
26-
{ target: 'test.cpu2', datapoints: [[1236547890, 55], [1234456709, 90]]}
25+
{ target: 'test.cpu1', datapoints: [[45, 1234567890], [60, 1234567899]]},
26+
{ target: 'test.cpu2', datapoints: [[55, 1236547890], [90, 1234456709]]}
2727
];
2828
ctx.ctrl.panel.tooltip.msResolution = false;
2929
ctx.ctrl.onDataReceived(data);
@@ -37,8 +37,8 @@ describe('GraphCtrl', function() {
3737
describe('msResolution with millisecond resolution timestamps', function() {
3838
beforeEach(function() {
3939
var data = [
40-
{ target: 'test.cpu1', datapoints: [[1234567890000, 45], [1234567899000, 60]]},
41-
{ target: 'test.cpu2', datapoints: [[1236547890001, 55], [1234456709000, 90]]}
40+
{ target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
41+
{ target: 'test.cpu2', datapoints: [[55, 1236547890001], [90, 1234456709000]]}
4242
];
4343
ctx.ctrl.panel.tooltip.msResolution = false;
4444
ctx.ctrl.onDataReceived(data);
@@ -52,8 +52,8 @@ describe('GraphCtrl', function() {
5252
describe('msResolution with millisecond resolution timestamps but with trailing zeroes', function() {
5353
beforeEach(function() {
5454
var data = [
55-
{ target: 'test.cpu1', datapoints: [[1234567890000, 45], [1234567899000, 60]]},
56-
{ target: 'test.cpu2', datapoints: [[1236547890000, 55], [1234456709000, 90]]}
55+
{ target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
56+
{ target: 'test.cpu2', datapoints: [[55, 1236547890000], [90, 1234456709000]]}
5757
];
5858
ctx.ctrl.panel.tooltip.msResolution = false;
5959
ctx.ctrl.onDataReceived(data);
@@ -67,9 +67,9 @@ describe('GraphCtrl', function() {
6767
describe('msResolution with millisecond resolution timestamps in one of the series', function() {
6868
beforeEach(function() {
6969
var data = [
70-
{ target: 'test.cpu1', datapoints: [[1234567890000, 45], [1234567899000, 60]]},
71-
{ target: 'test.cpu2', datapoints: [[1236547890010, 55], [1234456709000, 90]]},
72-
{ target: 'test.cpu3', datapoints: [[1236547890000, 65], [1234456709000, 120]]}
70+
{ target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
71+
{ target: 'test.cpu2', datapoints: [[55, 1236547890010], [90, 1234456709000]]},
72+
{ target: 'test.cpu3', datapoints: [[65, 1236547890000], [120, 1234456709000]]}
7373
];
7474
ctx.ctrl.panel.tooltip.msResolution = false;
7575
ctx.ctrl.onDataReceived(data);

public/test/core/time_series_specs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ define([
5656
});
5757
});
5858

59-
describe('can detect if serie contains ms precision', function() {
59+
describe('can detect if series contains ms precision', function() {
6060
var fakedata;
6161

6262
beforeEach(function() {
6363
fakedata = testData;
6464
});
6565

6666
it('missing datapoint with ms precision', function() {
67-
fakedata.datapoints[0] = [1234567890000, 1337];
67+
fakedata.datapoints[0] = [1337, 1234567890000];
6868
series = new TimeSeries(fakedata);
6969
expect(series.isMsResolutionNeeded()).to.be(false);
7070
});
7171

7272
it('contains datapoint with ms precision', function() {
73-
fakedata.datapoints[0] = [1236547890001, 1337];
73+
fakedata.datapoints[0] = [1337, 1236547890001];
7474
series = new TimeSeries(fakedata);
7575
expect(series.isMsResolutionNeeded()).to.be(true);
7676
});

0 commit comments

Comments
 (0)