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
b4c51f88
Commit
b4c51f88
authored
Feb 15, 2018
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix phantomjs legend rendering issue, #10526
parent
1a041a22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
public/app/plugins/panel/graph/legend.ts
+18
-0
No files found.
public/app/plugins/panel/graph/legend.ts
View file @
b4c51f88
...
...
@@ -234,6 +234,24 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
elem
.
append
(
seriesElements
);
}
// Phantomjs has rendering issue for CSS float property, so when legend values are present, legend takes
// all graph width and rendering fails. So it should be handled to avoid rendering timeout.
// See issue #10526 https://github.com/grafana/grafana/issues/10526
if
(
panel
.
legend
.
rightSide
)
{
const
legendWidth
=
elem
.
parent
().
width
();
const
panelWidth
=
elem
.
parent
().
width
();
let
maxLegendElementWidth
=
_
.
max
(
_
.
map
(
seriesElements
,
el
=>
$
(
el
).
width
()));
maxLegendElementWidth
=
_
.
isNumber
(
maxLegendElementWidth
)
?
maxLegendElementWidth
:
0
;
const
widthDiff
=
Math
.
abs
(
panelWidth
-
maxLegendElementWidth
);
// Set width to content size, but table takes all space anyway, so width shouldn't be more
// than 40% of panel in this case.
if
(
widthDiff
<
panelWidth
*
0.1
||
legendWidth
>
panelWidth
*
0.9
)
{
const
maxTableWidthPercent
=
0.4
;
const
maxWidth
=
Math
.
min
(
Math
.
ceil
(
maxLegendElementWidth
*
1.05
),
panelWidth
*
maxTableWidthPercent
);
elem
.
css
(
'max-width'
,
maxWidth
);
}
}
if
(
!
panel
.
legend
.
rightSide
)
{
addScrollbar
();
}
else
{
...
...
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