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
2cf1c29e
Commit
2cf1c29e
authored
Dec 06, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph: refactor (don't render twice)
parent
6b4b7969
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
33 deletions
+3
-33
public/app/plugins/panel/graph/graph.ts
+3
-33
No files found.
public/app/plugins/panel/graph/graph.ts
View file @
2cf1c29e
...
...
@@ -34,7 +34,6 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
var
data
;
var
plot
;
var
sortedSeries
;
var
legendSideLastValue
=
null
;
var
rootScope
=
scope
.
$root
;
var
panelWidth
=
0
;
var
eventManager
=
new
EventManager
(
ctrl
);
...
...
@@ -95,25 +94,14 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
},
scope
);
function
getLegendHeight
(
panelHeight
)
{
const
LEGEND_TABLE_LINE_HEIGHT
=
21
;
const
LEGEND_PADDING
=
23
;
if
(
!
panel
.
legend
.
show
||
panel
.
legend
.
rightSide
)
{
return
0
;
}
let
legendSeries
=
_
.
filter
(
data
,
function
(
series
)
{
return
series
.
hideFromLegend
(
panel
.
legend
)
===
false
;
});
if
(
panel
.
legend
.
alignAsTable
)
{
let
total
=
LEGEND_PADDING
+
(
LEGEND_TABLE_LINE_HEIGHT
*
legendSeries
.
length
);
return
Math
.
min
(
total
,
Math
.
floor
(
panelHeight
/
2
));
}
else
{
let
legendHeight
=
getLegendContainerHeight
();
let
total
=
LEGEND_PADDING
+
(
legendHeight
);
return
Math
.
min
(
total
,
Math
.
floor
(
panelHeight
/
2
));
}
let
legendHeight
=
getLegendContainerHeight
()
+
LEGEND_PADDING
;
return
Math
.
min
(
legendHeight
,
Math
.
floor
(
panelHeight
/
2
));
}
function
getLegendContainerHeight
()
{
...
...
@@ -254,15 +242,7 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
eventManager
.
addFlotEvents
(
annotations
,
options
);
sortedSeries
=
sortSeries
(
data
,
panel
);
if
(
shouldDelayDraw
(
panel
))
{
// temp fix for legends on the side, need to render twice to get dimensions right
callPlot
(
options
,
false
);
setTimeout
(
function
()
{
callPlot
(
options
,
true
);
},
50
);
legendSideLastValue
=
panel
.
legend
.
rightSide
;
}
else
{
callPlot
(
options
,
true
);
}
callPlot
(
options
,
true
);
}
function
buildFlotPairs
(
data
)
{
...
...
@@ -446,16 +426,6 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
}
}
function
shouldDelayDraw
(
panel
)
{
if
(
panel
.
legend
.
rightSide
)
{
return
true
;
}
if
(
legendSideLastValue
!==
null
&&
panel
.
legend
.
rightSide
!==
legendSideLastValue
)
{
return
true
;
}
return
false
;
}
function
addTimeAxis
(
options
)
{
var
ticks
=
panelWidth
/
100
;
var
min
=
_
.
isUndefined
(
ctrl
.
range
.
from
)
?
null
:
ctrl
.
range
.
from
.
valueOf
();
...
...
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