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
2ab19148
Commit
2ab19148
authored
Nov 08, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: toggle legend on/off from panel menu, #941, no keyboard shortcut yet, but could come
parent
d12f4a4a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
23 deletions
+13
-23
src/app/directives/panelMenu.js
+2
-2
src/app/panels/graph/module.js
+9
-10
src/app/services/dashboard/dashboardKeyBindings.js
+1
-2
src/app/services/dashboard/dashboardSrv.js
+1
-0
src/test/specs/graph-ctrl-specs.js
+0
-9
No files found.
src/app/directives/panelMenu.js
View file @
2ab19148
...
...
@@ -97,7 +97,7 @@ function (angular, $, _) {
$menu
=
$
(
menuTemplate
);
$menu
.
css
(
'left'
,
menuLeftPos
);
$menu
.
mouseleave
(
function
()
{
//
dismiss(1000);
dismiss
(
1000
);
});
menuScope
=
$scope
.
$new
();
...
...
@@ -111,7 +111,7 @@ function (angular, $, _) {
$
(
".panel-container"
).
removeClass
(
'panel-highlight'
);
$panelContainer
.
toggleClass
(
'panel-highlight'
);
//
dismiss(2500);
dismiss
(
2500
);
};
if
(
$scope
.
panelMeta
.
titlePos
&&
$scope
.
panel
.
title
)
{
...
...
src/app/panels/graph/module.js
View file @
2ab19148
...
...
@@ -37,6 +37,8 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
$scope
.
panelMeta
.
addEditorTab
(
'Axes & Grid'
,
'app/panels/graph/axisEditor.html'
);
$scope
.
panelMeta
.
addEditorTab
(
'Display Styles'
,
'app/panels/graph/styleEditor.html'
);
$scope
.
panelMeta
.
addExtendedMenuItem
(
'Toggle legend'
,
''
,
'toggleLegend()'
);
// Set and populate defaults
var
_d
=
{
// datasource name, null = default datasource
...
...
@@ -143,14 +145,12 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
$scope
.
panelMeta
.
loading
=
false
;
$scope
.
panelMeta
.
error
=
err
.
message
||
"Timeseries data request error"
;
$scope
.
inspector
.
error
=
err
;
$scope
.
legend
=
[];
$scope
.
render
([]);
});
};
$scope
.
dataHandler
=
function
(
results
)
{
$scope
.
panelMeta
.
loading
=
false
;
$scope
.
legend
=
[];
// png renderer returns just a url
if
(
_
.
isString
(
results
))
{
...
...
@@ -180,16 +180,9 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
var
alias
=
seriesData
.
target
;
var
color
=
$scope
.
panel
.
aliasColors
[
alias
]
||
$rootScope
.
colors
[
index
];
var
seriesInfo
=
{
alias
:
alias
,
color
:
color
,
};
$scope
.
legend
.
push
(
seriesInfo
);
var
series
=
new
TimeSeries
({
datapoints
:
datapoints
,
info
:
seriesInfo
,
info
:
{
alias
:
alias
,
color
:
color
}
,
});
if
(
datapoints
&&
datapoints
.
length
>
0
)
{
...
...
@@ -288,6 +281,12 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
$scope
.
render
();
};
// Called from panel menu
$scope
.
toggleLegend
=
function
()
{
$scope
.
panel
.
legend
.
show
=
!
$scope
.
panel
.
legend
.
show
;
$scope
.
get_data
();
};
panelSrv
.
init
(
$scope
);
});
...
...
src/app/services/dashboard/dashboardKeyBindings.js
View file @
2ab19148
...
...
@@ -51,8 +51,7 @@ function(angular, $) {
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'ctrl+l'
,
function
()
{
scope
.
dashboard
.
hideAllLegends
=
!
scope
.
dashboard
.
hideAllLegends
;
scope
.
dashboard
.
emit_refresh
(
'refresh'
);
scope
.
$broadcast
(
'toggle-all-legends'
);
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'ctrl+h'
,
function
()
{
...
...
src/app/services/dashboard/dashboardSrv.js
View file @
2ab19148
...
...
@@ -35,6 +35,7 @@ function (angular, $, kbn, _, moment) {
this
.
annotations
=
this
.
_ensureListExist
(
data
.
annotations
);
this
.
refresh
=
data
.
refresh
;
this
.
version
=
data
.
version
||
0
;
this
.
hideAllLegends
=
data
.
hideAllLegends
||
false
;
if
(
this
.
nav
.
length
===
0
)
{
this
.
nav
.
push
({
type
:
'timepicker'
});
...
...
src/test/specs/graph-ctrl-specs.js
View file @
2ab19148
...
...
@@ -27,11 +27,6 @@ define([
ctx
.
scope
.
$digest
();
});
it
(
'should build legend model'
,
function
()
{
expect
(
ctx
.
scope
.
legend
[
0
].
alias
).
to
.
be
(
'test.cpu1'
);
expect
(
ctx
.
scope
.
legend
[
1
].
alias
).
to
.
be
(
'test.cpu2'
);
});
it
(
'should send time series to render'
,
function
()
{
var
data
=
ctx
.
scope
.
render
.
getCall
(
0
).
args
[
0
];
expect
(
data
.
length
).
to
.
be
(
2
);
...
...
@@ -44,10 +39,6 @@ define([
ctx
.
scope
.
$digest
();
});
it
(
'should clear the legend data'
,
function
()
{
expect
(
ctx
.
scope
.
legend
).
to
.
eql
([]);
});
});
});
...
...
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