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
bf82fdb6
Commit
bf82fdb6
authored
Jun 08, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'perf_graph_js' of
https://github.com/mtanda/grafana
into mtanda-perf_graph_js
parents
e1e7fbf8
487b2089
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
5 deletions
+33
-5
public/app/plugins/panel/graph/graph.js
+33
-5
No files found.
public/app/plugins/panel/graph/graph.js
View file @
bf82fdb6
...
...
@@ -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,11 +105,28 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
return
true
;
}
if
(
elem
.
width
()
===
0
)
{
if
(
panelWidth
===
0
)
{
return
true
;
}
}
function
getLabelWidth
(
type
,
text
,
elem
)
{
var
labelWidth
=
0
;
if
(
!
rootScope
.
labelWidthCache
)
{
rootScope
.
labelWidthCache
=
{};
}
if
(
!
rootScope
.
labelWidthCache
[
type
])
{
rootScope
.
labelWidthCache
[
type
]
=
{};
}
if
(
rootScope
.
labelWidthCache
[
type
][
text
])
{
labelWidth
=
rootScope
.
labelWidthCache
[
type
][
text
];
}
else
{
labelWidth
=
elem
.
width
();
rootScope
.
labelWidthCache
[
type
][
text
]
=
labelWidth
;
}
return
labelWidth
;
}
function
drawHook
(
plot
)
{
// Update legend values
var
yaxis
=
plot
.
getYAxes
();
...
...
@@ -137,7 +155,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
.
text
(
panel
.
yaxes
[
0
].
label
)
.
appendTo
(
elem
);
yaxisLabel
.
css
(
"margin-top"
,
yaxisLabel
.
width
()
/
2
)
;
yaxisLabel
[
0
].
style
.
marginTop
=
(
getLabelWidth
(
'left'
,
panel
.
yaxes
[
0
].
label
,
yaxisLabel
)
/
2
)
+
'px'
;
}
// add right axis labels
...
...
@@ -146,7 +164,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) {
.
text
(
panel
.
yaxes
[
1
].
label
)
.
appendTo
(
elem
);
rightLabel
.
css
(
"margin-top"
,
rightLabel
.
width
()
/
2
)
;
rightLabel
[
0
].
style
.
marginTop
=
(
getLabelWidth
(
'right'
,
panel
.
yaxes
[
1
].
label
,
rightLabel
)
/
2
)
+
'px'
;
}
}
...
...
@@ -159,6 +177,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 +304,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 +472,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