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
2b5fa599
Commit
2b5fa599
authored
Apr 12, 2015
by
Masaori Koshiba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix styles warned by jshint
parent
ae2201ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
public/app/plugins/datasource/kairosdb/datasource.js
+15
-8
No files found.
public/app/plugins/datasource/kairosdb/datasource.js
View file @
2b5fa599
...
@@ -29,8 +29,9 @@ function (angular, _, kbn) {
...
@@ -29,8 +29,9 @@ function (angular, _, kbn) {
var
queries
=
_
.
compact
(
_
.
map
(
options
.
targets
,
_
.
partial
(
convertTargetToQuery
,
options
)));
var
queries
=
_
.
compact
(
_
.
map
(
options
.
targets
,
_
.
partial
(
convertTargetToQuery
,
options
)));
var
plotParams
=
_
.
compact
(
_
.
map
(
options
.
targets
,
function
(
target
)
{
var
plotParams
=
_
.
compact
(
_
.
map
(
options
.
targets
,
function
(
target
)
{
var
alias
=
target
.
alias
;
var
alias
=
target
.
alias
;
if
(
typeof
target
.
alias
==
'undefined'
||
target
.
alias
==
""
)
if
(
typeof
target
.
alias
==
=
'undefined'
||
target
.
alias
===
""
)
{
alias
=
target
.
metric
;
alias
=
target
.
metric
;
}
return
!
target
.
hide
return
!
target
.
hide
?
{
alias
:
alias
,
?
{
alias
:
alias
,
exouter
:
target
.
exOuter
}
exouter
:
target
.
exOuter
}
...
@@ -171,8 +172,9 @@ function (angular, _, kbn) {
...
@@ -171,8 +172,9 @@ function (angular, _, kbn) {
}
}
});
});
details
+=
") "
;
details
+=
") "
;
if
(
details
!=
" ( ) "
)
if
(
details
!=
=
" ( ) "
)
{
target
+=
details
;
target
+=
details
;
}
var
datapoints
=
[];
var
datapoints
=
[];
for
(
var
i
=
0
;
i
<
result
.
values
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
result
.
values
.
length
;
i
++
)
{
...
@@ -180,8 +182,9 @@ function (angular, _, kbn) {
...
@@ -180,8 +182,9 @@ function (angular, _, kbn) {
var
v
=
result
.
values
[
i
][
1
];
var
v
=
result
.
values
[
i
][
1
];
datapoints
[
i
]
=
[
v
,
t
];
datapoints
[
i
]
=
[
v
,
t
];
}
}
if
(
plotParams
[
index
].
exouter
)
if
(
plotParams
[
index
].
exouter
)
{
datapoints
=
PeakFilter
(
datapoints
,
10
);
datapoints
=
new
PeakFilter
(
datapoints
,
10
);
}
output
.
push
({
target
:
target
,
datapoints
:
datapoints
});
output
.
push
({
target
:
target
,
datapoints
:
datapoints
});
});
});
index
++
;
index
++
;
...
@@ -387,28 +390,32 @@ function (angular, _, kbn) {
...
@@ -387,28 +390,32 @@ function (angular, _, kbn) {
function
PeakFilter
(
dataIn
,
limit
)
{
function
PeakFilter
(
dataIn
,
limit
)
{
var
datapoints
=
dataIn
;
var
datapoints
=
dataIn
;
var
arrLength
=
datapoints
.
length
;
var
arrLength
=
datapoints
.
length
;
if
(
arrLength
<=
3
)
if
(
arrLength
<=
3
)
{
return
datapoints
;
return
datapoints
;
}
var
LastIndx
=
arrLength
-
1
;
var
LastIndx
=
arrLength
-
1
;
// Check first point
// Check first point
var
prvDelta
=
Math
.
abs
((
datapoints
[
1
][
0
]
-
datapoints
[
0
][
0
])
/
datapoints
[
0
][
0
]);
var
prvDelta
=
Math
.
abs
((
datapoints
[
1
][
0
]
-
datapoints
[
0
][
0
])
/
datapoints
[
0
][
0
]);
var
nxtDelta
=
Math
.
abs
((
datapoints
[
1
][
0
]
-
datapoints
[
2
][
0
])
/
datapoints
[
2
][
0
]);
var
nxtDelta
=
Math
.
abs
((
datapoints
[
1
][
0
]
-
datapoints
[
2
][
0
])
/
datapoints
[
2
][
0
]);
if
(
prvDelta
>=
limit
&&
nxtDelta
<
limit
)
if
(
prvDelta
>=
limit
&&
nxtDelta
<
limit
)
{
datapoints
[
0
][
0
]
=
datapoints
[
1
][
0
];
datapoints
[
0
][
0
]
=
datapoints
[
1
][
0
];
}
// Check last point
// Check last point
prvDelta
=
Math
.
abs
((
datapoints
[
LastIndx
-
1
][
0
]
-
datapoints
[
LastIndx
-
2
][
0
])
/
datapoints
[
LastIndx
-
2
][
0
]);
prvDelta
=
Math
.
abs
((
datapoints
[
LastIndx
-
1
][
0
]
-
datapoints
[
LastIndx
-
2
][
0
])
/
datapoints
[
LastIndx
-
2
][
0
]);
nxtDelta
=
Math
.
abs
((
datapoints
[
LastIndx
-
1
][
0
]
-
datapoints
[
LastIndx
][
0
])
/
datapoints
[
LastIndx
][
0
]);
nxtDelta
=
Math
.
abs
((
datapoints
[
LastIndx
-
1
][
0
]
-
datapoints
[
LastIndx
][
0
])
/
datapoints
[
LastIndx
][
0
]);
if
(
prvDelta
>=
limit
&&
nxtDelta
<
limit
)
if
(
prvDelta
>=
limit
&&
nxtDelta
<
limit
)
{
datapoints
[
LastIndx
][
0
]
=
datapoints
[
LastIndx
-
1
][
0
];
datapoints
[
LastIndx
][
0
]
=
datapoints
[
LastIndx
-
1
][
0
];
}
for
(
var
i
=
1
;
i
<
arrLength
-
1
;
i
++
)
{
for
(
var
i
=
1
;
i
<
arrLength
-
1
;
i
++
)
{
prvDelta
=
Math
.
abs
((
datapoints
[
i
][
0
]
-
datapoints
[
i
-
1
][
0
])
/
datapoints
[
i
-
1
][
0
]);
prvDelta
=
Math
.
abs
((
datapoints
[
i
][
0
]
-
datapoints
[
i
-
1
][
0
])
/
datapoints
[
i
-
1
][
0
]);
nxtDelta
=
Math
.
abs
((
datapoints
[
i
][
0
]
-
datapoints
[
i
+
1
][
0
])
/
datapoints
[
i
+
1
][
0
]);
nxtDelta
=
Math
.
abs
((
datapoints
[
i
][
0
]
-
datapoints
[
i
+
1
][
0
])
/
datapoints
[
i
+
1
][
0
]);
if
(
prvDelta
>=
limit
&&
nxtDelta
>=
limit
)
if
(
prvDelta
>=
limit
&&
nxtDelta
>=
limit
)
{
datapoints
[
i
][
0
]
=
(
datapoints
[
i
-
1
][
0
]
+
datapoints
[
i
+
1
][
0
])
/
2
;
datapoints
[
i
][
0
]
=
(
datapoints
[
i
-
1
][
0
]
+
datapoints
[
i
+
1
][
0
])
/
2
;
}
}
}
return
datapoints
;
return
datapoints
;
}
}
...
...
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