Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
517721ea
Commit
517721ea
authored
Feb 28, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4108 from benrubson/issue3982-3
Make auto interval calculation more accurate
parents
b56a2c14
2034d4b9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
17 deletions
+44
-17
public/app/core/utils/kbn.js
+42
-15
public/test/core/utils/kbn_specs.js
+2
-2
No files found.
public/app/core/utils/kbn.js
View file @
517721ea
...
...
@@ -12,39 +12,66 @@ function($, _) {
kbn
.
round_interval
=
function
(
interval
)
{
switch
(
true
)
{
// 0.
5
s
case
(
interval
<=
5
00
):
// 0.
3
s
case
(
interval
<=
3
00
):
return
100
;
// 0.1s
// 5s
case
(
interval
<=
5000
):
// 0.75s
case
(
interval
<=
750
):
return
500
;
// 0.5s
// 1.5s
case
(
interval
<=
1500
):
return
1000
;
// 1s
// 3.5s
case
(
interval
<=
3500
):
return
2000
;
// 2s
// 7.5s
case
(
interval
<=
7500
):
return
5000
;
// 5s
// 15s
case
(
interval
<=
1
50
00
):
// 1
2.
5s
case
(
interval
<=
1
25
00
):
return
10000
;
// 10s
// 17.5s
case
(
interval
<=
17500
):
return
15000
;
// 15s
// 25s
case
(
interval
<=
25000
):
return
20000
;
// 20s
// 45s
case
(
interval
<=
45000
):
return
30000
;
// 30s
//
3
m
case
(
interval
<=
18
0000
):
//
1.5
m
case
(
interval
<=
9
0000
):
return
60000
;
// 1m
// 9m
// 3.5m
case
(
interval
<=
210000
):
return
120000
;
// 2m
// 7.5m
case
(
interval
<=
450000
):
return
300000
;
// 5m
//
20
m
case
(
interval
<=
120
0000
):
//
12.5
m
case
(
interval
<=
75
0000
):
return
600000
;
// 10m
// 12.5m
case
(
interval
<=
1050000
):
return
900000
;
// 15m
// 25m
case
(
interval
<=
1500000
):
return
1200000
;
// 20m
// 45m
case
(
interval
<=
2700000
):
return
1800000
;
// 30m
//
2
h
case
(
interval
<=
72
00000
):
//
1.5
h
case
(
interval
<=
54
00000
):
return
3600000
;
// 1h
// 6h
case
(
interval
<=
21600000
):
// 2.5h
case
(
interval
<=
9000000
):
return
7200000
;
// 2h
// 4.5h
case
(
interval
<=
16200000
):
return
10800000
;
// 3h
// 9h
case
(
interval
<=
32400000
):
return
21600000
;
// 6h
// 24h
case
(
interval
<=
86400000
):
return
43200000
;
// 12h
...
...
public/test/core/utils/kbn_specs.js
View file @
517721ea
...
...
@@ -127,7 +127,7 @@ define([
it
(
'10m 1600 resolution'
,
function
()
{
var
range
=
{
from
:
dateMath
.
parse
(
'now-10m'
),
to
:
dateMath
.
parse
(
'now'
)
};
var
str
=
kbn
.
calculateInterval
(
range
,
1600
,
null
);
expect
(
str
).
to
.
be
(
'
1
00ms'
);
expect
(
str
).
to
.
be
(
'
5
00ms'
);
});
it
(
'fixed user interval'
,
function
()
{
...
...
@@ -145,7 +145,7 @@ define([
it
(
'large time range and user low limit'
,
function
()
{
var
range
=
{
from
:
dateMath
.
parse
(
'now-14d'
),
to
:
dateMath
.
parse
(
'now'
)
};
var
str
=
kbn
.
calculateInterval
(
range
,
1000
,
'>10s'
);
expect
(
str
).
to
.
be
(
'
3
0m'
);
expect
(
str
).
to
.
be
(
'
2
0m'
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment