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
272cf64a
Commit
272cf64a
authored
Oct 23, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SinglsStatPanel: more work on sparkline option for single stat panel
parent
ed57a409
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
29 deletions
+37
-29
src/app/panels/stats/statsDirective.js
+37
-29
No files found.
src/app/panels/stats/statsDirective.js
View file @
272cf64a
...
...
@@ -84,34 +84,8 @@ function (angular, app, _, kbn, $) {
return
'<span class="stats-panel-value-small">'
+
text
+
'</span>'
;
}
function
render
()
{
setElementHeight
();
function
addSparkline
()
{
var
panel
=
scope
.
panel
;
var
body
=
''
;
body
+=
'<div class="stats-panel-value-container">'
;
body
+=
'<span class="stats-panel-value">'
;
var
valueHtml
=
panel
.
template
.
replace
(
valueRegex
,
valueTemplateReplaceFunc
);
body
+=
valueHtml
.
replace
(
smallValueTextRegex
,
smallValueTextReplaceFunc
);
body
+=
'</div>'
;
body
+=
'</div>'
;
if
(
panel
.
colorBackground
&&
data
.
mainValue
)
{
var
color
=
getColorForValue
(
data
.
mainValue
);
if
(
color
)
{
$panelContainer
.
css
(
'background-color'
,
color
);
if
(
scope
.
fullscreen
)
{
elem
.
css
(
'background-color'
,
color
);
}
else
{
elem
.
css
(
'background-color'
,
''
);
}
}
}
else
{
$panelContainer
.
css
(
'background-color'
,
''
);
elem
.
css
(
'background-color'
,
''
);
}
var
width
=
elem
.
width
()
+
20
;
var
height
=
elem
.
height
()
||
100
;
...
...
@@ -154,14 +128,48 @@ function (angular, app, _, kbn, $) {
grid
:
{
hoverable
:
false
,
show
:
false
},
};
elem
.
html
(
body
);
elem
.
append
(
plotCanvas
);
data
.
series
[
0
].
color
=
panel
.
sparkline
.
lineColor
;
setTimeout
(
function
()
{
$
.
plot
(
plotCanvas
,
[
data
.
series
[
0
]],
options
);
},
200
);
},
10
);
}
function
render
()
{
setElementHeight
();
var
panel
=
scope
.
panel
;
var
body
=
''
;
body
+=
'<div class="stats-panel-value-container">'
;
body
+=
'<span class="stats-panel-value">'
;
var
valueHtml
=
panel
.
template
.
replace
(
valueRegex
,
valueTemplateReplaceFunc
);
body
+=
valueHtml
.
replace
(
smallValueTextRegex
,
smallValueTextReplaceFunc
);
body
+=
'</div>'
;
body
+=
'</div>'
;
if
(
panel
.
colorBackground
&&
data
.
mainValue
)
{
var
color
=
getColorForValue
(
data
.
mainValue
);
if
(
color
)
{
$panelContainer
.
css
(
'background-color'
,
color
);
if
(
scope
.
fullscreen
)
{
elem
.
css
(
'background-color'
,
color
);
}
else
{
elem
.
css
(
'background-color'
,
''
);
}
}
}
else
{
$panelContainer
.
css
(
'background-color'
,
''
);
elem
.
css
(
'background-color'
,
''
);
}
elem
.
html
(
body
);
if
(
panel
.
sparkline
.
show
)
{
addSparkline
();
}
}
}
};
...
...
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