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
58d40eb6
Commit
58d40eb6
authored
Dec 07, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph: fix legend height calculation
parent
3cdf0dce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
public/app/plugins/panel/graph/legend.ts
+20
-4
No files found.
public/app/plugins/panel/graph/legend.ts
View file @
58d40eb6
...
...
@@ -27,8 +27,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
ctrl
.
events
.
emit
(
'legend-rendering-complete'
);
});
function
updateLegendDecimals
()
{
let
graphHeight
=
ctrl
.
height
-
$container
.
height
();
function
updateLegendDecimals
(
graphHeight
)
{
updateLegendValues
(
data
,
panel
,
graphHeight
);
}
...
...
@@ -155,8 +154,21 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
}
}
var
seriesElements
=
[];
// render first time for getting proper legend height
if
(
!
panel
.
legend
.
rightSide
)
{
renderLegendElement
(
tableHeaderElem
);
let
graphHeight
=
ctrl
.
height
-
$container
.
height
()
-
23
;
updateLegendDecimals
(
graphHeight
);
$container
.
empty
();
}
else
{
updateLegendDecimals
(
ctrl
.
height
);
}
renderLegendElement
(
tableHeaderElem
);
}
function
renderSeriesLegendElements
()
{
let
seriesElements
=
[];
for
(
i
=
0
;
i
<
seriesList
.
length
;
i
++
)
{
var
series
=
seriesList
[
i
];
...
...
@@ -176,7 +188,6 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
html
+=
'<a class="graph-legend-alias pointer" title="'
+
series
.
aliasEscaped
+
'">'
+
series
.
aliasEscaped
+
'</a>'
;
if
(
panel
.
legend
.
values
)
{
updateLegendDecimals
();
var
avg
=
series
.
formatValue
(
series
.
stats
.
avg
);
var
current
=
series
.
formatValue
(
series
.
stats
.
current
);
var
min
=
series
.
formatValue
(
series
.
stats
.
min
);
...
...
@@ -193,6 +204,11 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
html
+=
'</div>'
;
seriesElements
.
push
(
$
(
html
));
}
return
seriesElements
;
}
function
renderLegendElement
(
tableHeaderElem
)
{
var
seriesElements
=
renderSeriesLegendElements
();
if
(
panel
.
legend
.
alignAsTable
)
{
var
maxHeight
=
ctrl
.
height
;
...
...
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