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
6f0ce35c
Commit
6f0ce35c
authored
Feb 15, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #97, legend values now use selected y axis formater for precision and formating
parent
39bbd560
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
29 deletions
+59
-29
src/app/directives/grafanaGraph.js
+27
-25
src/app/panels/graphite/timeSeries.js
+32
-4
No files found.
src/app/directives/grafanaGraph.js
View file @
6f0ce35c
...
@@ -132,35 +132,13 @@ function (angular, $, kbn, moment, _) {
...
@@ -132,35 +132,13 @@ function (angular, $, kbn, moment, _) {
}
}
};
};
if
(
panel
.
grid
.
threshold1
)
{
var
limit1
=
panel
.
grid
.
thresholdLine
?
panel
.
grid
.
threshold1
:
(
panel
.
grid
.
threshold2
||
null
);
options
.
grid
.
markings
=
[];
options
.
grid
.
markings
.
push
({
yaxis
:
{
from
:
panel
.
grid
.
threshold1
,
to
:
limit1
},
color
:
panel
.
grid
.
threshold1Color
});
if
(
panel
.
grid
.
threshold2
)
{
var
limit2
;
if
(
panel
.
grid
.
thresholdLine
)
{
limit2
=
panel
.
grid
.
threshold2
;
}
else
{
limit2
=
panel
.
grid
.
threshold1
>
panel
.
grid
.
threshold2
?
-
Infinity
:
+
Infinity
;
}
options
.
grid
.
markings
.
push
({
yaxis
:
{
from
:
panel
.
grid
.
threshold2
,
to
:
limit2
},
color
:
panel
.
grid
.
threshold2Color
});
}
}
addAnnotations
(
options
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
_d
=
data
[
i
].
getFlotPairs
(
panel
.
nullPointMode
);
var
_d
=
data
[
i
].
getFlotPairs
(
panel
.
nullPointMode
,
panel
.
y_formats
);
data
[
i
].
data
=
_d
;
data
[
i
].
data
=
_d
;
}
}
addGridThresholds
(
options
,
panel
);
addAnnotations
(
options
);
configureAxisOptions
(
data
,
options
);
configureAxisOptions
(
data
,
options
);
plot
=
$
.
plot
(
elem
,
data
,
options
);
plot
=
$
.
plot
(
elem
,
data
,
options
);
...
@@ -210,6 +188,30 @@ function (angular, $, kbn, moment, _) {
...
@@ -210,6 +188,30 @@ function (angular, $, kbn, moment, _) {
elem
.
html
(
'<img src="'
+
url
+
'"></img>'
);
elem
.
html
(
'<img src="'
+
url
+
'"></img>'
);
}
}
function
addGridThresholds
(
options
,
panel
)
{
if
(
panel
.
grid
.
threshold1
)
{
var
limit1
=
panel
.
grid
.
thresholdLine
?
panel
.
grid
.
threshold1
:
(
panel
.
grid
.
threshold2
||
null
);
options
.
grid
.
markings
=
[];
options
.
grid
.
markings
.
push
({
yaxis
:
{
from
:
panel
.
grid
.
threshold1
,
to
:
limit1
},
color
:
panel
.
grid
.
threshold1Color
});
if
(
panel
.
grid
.
threshold2
)
{
var
limit2
;
if
(
panel
.
grid
.
thresholdLine
)
{
limit2
=
panel
.
grid
.
threshold2
;
}
else
{
limit2
=
panel
.
grid
.
threshold1
>
panel
.
grid
.
threshold2
?
-
Infinity
:
+
Infinity
;
}
options
.
grid
.
markings
.
push
({
yaxis
:
{
from
:
panel
.
grid
.
threshold2
,
to
:
limit2
},
color
:
panel
.
grid
.
threshold2Color
});
}
}
}
function
addAnnotations
(
options
)
{
function
addAnnotations
(
options
)
{
if
(
!
data
.
annotations
||
data
.
annotations
.
length
===
0
)
{
if
(
!
data
.
annotations
||
data
.
annotations
.
length
===
0
)
{
return
;
return
;
...
...
src/app/panels/graphite/timeSeries.js
View file @
6f0ce35c
define
([
define
([
'underscore'
'underscore'
,
'kbn'
],
],
function
(
_
)
{
function
(
_
,
kbn
)
{
'use strict'
;
'use strict'
;
var
ts
=
{};
var
ts
=
{};
...
@@ -12,7 +13,7 @@ function (_) {
...
@@ -12,7 +13,7 @@ function (_) {
this
.
label
=
opts
.
info
.
alias
;
this
.
label
=
opts
.
info
.
alias
;
};
};
ts
.
ZeroFilled
.
prototype
.
getFlotPairs
=
function
(
fillStyle
)
{
ts
.
ZeroFilled
.
prototype
.
getFlotPairs
=
function
(
fillStyle
,
yFormats
)
{
var
result
=
[];
var
result
=
[];
this
.
color
=
this
.
info
.
color
;
this
.
color
=
this
.
info
.
color
;
...
@@ -50,13 +51,39 @@ function (_) {
...
@@ -50,13 +51,39 @@ function (_) {
},
this
);
},
this
);
if
(
result
.
length
)
{
if
(
result
.
length
)
{
this
.
info
.
avg
=
(
this
.
info
.
total
/
result
.
length
)
.
toFixed
(
2
)
;
this
.
info
.
avg
=
(
this
.
info
.
total
/
result
.
length
);
this
.
info
.
current
=
result
[
result
.
length
-
1
][
1
];
this
.
info
.
current
=
result
[
result
.
length
-
1
][
1
];
var
formater
=
getFormater
(
yFormats
[
this
.
yaxis
-
1
]);
this
.
info
.
avg
=
formater
(
this
.
info
.
avg
);
this
.
info
.
current
=
formater
(
this
.
info
.
current
);
this
.
info
.
min
=
formater
(
this
.
info
.
min
);
this
.
info
.
max
=
formater
(
this
.
info
.
max
);
this
.
info
.
total
=
formater
(
this
.
info
.
total
);
}
}
return
result
;
return
result
;
};
};
function
getFormater
(
yformat
)
{
switch
(
yformat
)
{
case
'bytes'
:
return
kbn
.
byteFormat
;
case
'short'
:
return
kbn
.
shortFormat
;
case
'ms'
:
return
kbn
.
msFormat
;
default
:
return
function
(
val
)
{
if
(
val
%
1
===
0
)
{
return
val
;
}
else
{
return
val
.
toFixed
(
2
);
}
};
}
}
return
ts
;
return
ts
;
});
});
\ No newline at end of file
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