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
b28368c8
Commit
b28368c8
authored
May 31, 2016
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache panel width
parent
2f5ae85d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
public/app/plugins/panel/graph/graph.js
+14
-3
No files found.
public/app/plugins/panel/graph/graph.js
View file @
b28368c8
...
...
@@ -31,6 +31,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
var
sortedSeries
;
var
legendSideLastValue
=
null
;
var
rootScope
=
scope
.
$root
;
var
panelWidth
=
0
;
rootScope
.
onAppEvent
(
'setCrosshair'
,
function
(
event
,
info
)
{
// do not need to to this if event is from this panel
...
...
@@ -104,7 +105,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
return
true
;
}
if
(
elem
.
width
()
===
0
)
{
if
(
panelWidth
===
0
)
{
return
true
;
}
}
...
...
@@ -159,6 +160,16 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
// Function for rendering panel
function
render_panel
()
{
if
(
!
rootScope
.
panelWidthCache
)
{
rootScope
.
panelWidthCache
=
{};
}
if
(
rootScope
.
panelWidthCache
[
panel
.
span
])
{
panelWidth
=
rootScope
.
panelWidthCache
[
panel
.
span
];
}
else
{
panelWidth
=
elem
.
width
();
rootScope
.
panelWidthCache
[
panel
.
span
]
=
panelWidth
;
}
if
(
shouldAbortRender
())
{
return
;
}
...
...
@@ -276,7 +287,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
}
function
addTimeAxis
(
options
)
{
var
ticks
=
elem
.
width
()
/
100
;
var
ticks
=
panelWidth
/
100
;
var
min
=
_
.
isUndefined
(
ctrl
.
range
.
from
)
?
null
:
ctrl
.
range
.
from
.
valueOf
();
var
max
=
_
.
isUndefined
(
ctrl
.
range
.
to
)
?
null
:
ctrl
.
range
.
to
.
valueOf
();
...
...
@@ -444,7 +455,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
}
function
render_panel_as_graphite_png
(
url
)
{
url
+=
'&width='
+
elem
.
width
()
;
url
+=
'&width='
+
panelWidth
;
url
+=
'&height='
+
elem
.
css
(
'height'
).
replace
(
'px'
,
''
);
url
+=
'&bgcolor=1f1f1f'
;
// @grayDarker & @grafanaPanelBackground
url
+=
'&fgcolor=BBBFC2'
;
// @textColor & @grayLighter
...
...
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