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
44f2a375
Commit
44f2a375
authored
Sep 30, 2014
by
toni-moreno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added shared crosshair to dashboards to track better all graphs, and little Fix for #884
parent
282c834d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
8 deletions
+40
-8
src/app/directives/grafanaGraph.js
+16
-2
src/app/directives/grafanaGraph.tooltip.js
+16
-6
src/app/partials/dasheditor.html
+1
-0
src/app/services/dashboard/dashboardKeyBindings.js
+6
-0
src/app/services/dashboard/dashboardSrv.js
+1
-0
No files found.
src/app/directives/grafanaGraph.js
View file @
44f2a375
...
...
@@ -19,6 +19,20 @@ function (angular, $, kbn, moment, _, graphTooltip) {
var
dashboard
=
scope
.
dashboard
;
var
data
,
annotations
;
var
legendSideLastValue
=
null
;
scope
.
crosshairEmiter
=
false
;
scope
.
$on
(
'setCrosshair'
,
function
(
event
,
pos
)
{
console
.
log
(
'setCrosshair'
+
pos
);
if
(
dashboard
.
sharedCrosshair
&&
!
scope
.
crosshairEmiter
)
{
var
plot
=
elem
.
data
().
plot
;
plot
.
setCrosshair
({
x
:
pos
.
x
,
y
:
pos
.
y
});
}
});
scope
.
$on
(
'clearCrosshair'
,
function
()
{
var
plot
=
elem
.
data
().
plot
;
plot
.
clearCrosshair
();
});
scope
.
$on
(
'refresh'
,
function
()
{
scope
.
get_data
();
...
...
@@ -147,7 +161,7 @@ function (angular, $, kbn, moment, _, graphTooltip) {
color
:
'#666'
},
crosshair
:
{
mode
:
panel
.
tooltip
.
shared
?
"x"
:
null
mode
:
panel
.
tooltip
.
shared
||
dashboard
.
sharedCrosshair
?
"x"
:
null
}
};
...
...
@@ -394,7 +408,7 @@ function (angular, $, kbn, moment, _, graphTooltip) {
elem
.
html
(
'<img src="'
+
url
+
'"></img>'
);
}
graphTooltip
.
register
(
elem
,
dashboard
,
scope
);
graphTooltip
.
register
(
elem
,
dashboard
,
scope
,
$rootScope
);
elem
.
bind
(
"plotselected"
,
function
(
event
,
ranges
)
{
scope
.
$apply
(
function
()
{
...
...
src/app/directives/grafanaGraph.tooltip.js
View file @
44f2a375
...
...
@@ -5,7 +5,7 @@ define([
function
(
$
,
kbn
)
{
'use strict'
;
function
registerTooltipFeatures
(
elem
,
dashboard
,
scope
)
{
function
registerTooltipFeatures
(
elem
,
dashboard
,
scope
,
$rootScope
)
{
var
$tooltip
=
$
(
'<div id="tooltip">'
);
...
...
@@ -13,7 +13,8 @@ function ($, kbn) {
if
(
scope
.
panel
.
tooltip
.
shared
)
{
var
plot
=
elem
.
data
().
plot
;
$tooltip
.
detach
();
plot
.
clearCrosshair
();
$rootScope
.
$broadcast
(
'clearCrosshair'
);
//plot.clearCrosshair();
plot
.
unhighlight
();
}
});
...
...
@@ -32,6 +33,11 @@ function ($, kbn) {
var
data
=
plot
.
getData
();
var
group
,
value
,
timestamp
,
seriesInfo
,
format
,
i
,
series
,
hoverIndex
,
seriesHtml
;
scope
.
crosshairEmiter
=
true
;
if
(
dashboard
.
sharedCrosshair
){
$rootScope
.
$broadcast
(
'setCrosshair'
,
pos
);
}
scope
.
crosshairEmiter
=
false
;
if
(
scope
.
panel
.
tooltip
.
shared
)
{
plot
.
unhighlight
();
...
...
@@ -60,11 +66,15 @@ function ($, kbn) {
seriesInfo
=
series
.
info
;
format
=
scope
.
panel
.
y_formats
[
seriesInfo
.
yaxis
-
1
];
if
(
scope
.
panel
.
stack
&&
scope
.
panel
.
tooltip
.
value_type
===
'individual'
)
{
value
=
series
.
data
[
hoverIndex
][
1
];
if
(
scope
.
panel
.
stack
)
{
if
(
scope
.
panel
.
stack
&&
scope
.
panel
.
tooltip
.
value_type
===
'individual'
)
{
value
=
series
.
data
[
hoverIndex
][
1
];
}
else
{
last_value
+=
series
.
data
[
hoverIndex
][
1
];
value
=
last_value
;
}
}
else
{
last_value
+=
series
.
data
[
hoverIndex
][
1
];
value
=
last_value
;
value
=
series
.
data
[
hoverIndex
][
1
];
}
value
=
kbn
.
valueFormats
[
format
](
value
,
series
.
yaxis
.
tickDecimals
);
...
...
src/app/partials/dasheditor.html
View file @
44f2a375
...
...
@@ -29,6 +29,7 @@
<select
ng-model=
"dashboard.timezone"
class=
'input-small'
ng-options=
"f for f in ['browser','utc']"
></select>
</div>
<editor-opt-bool
text=
"Hide controls (CTRL+H)"
model=
"dashboard.hideControls"
></editor-opt-bool>
<editor-opt-bool
text=
"Shared Crosshair (CTRL+O)"
model=
"dashboard.sharedCrosshair"
></editor-opt-bool>
</div>
</div>
<div
class=
"editor-row"
>
...
...
src/app/services/dashboard/dashboardKeyBindings.js
View file @
44f2a375
...
...
@@ -18,6 +18,7 @@ function(angular, $) {
keyboardManager
.
unbind
(
'ctrl+s'
);
keyboardManager
.
unbind
(
'ctrl+r'
);
keyboardManager
.
unbind
(
'ctrl+z'
);
keyboardManager
.
unbind
(
'ctrl+o'
);
keyboardManager
.
unbind
(
'esc'
);
});
...
...
@@ -25,6 +26,11 @@ function(angular, $) {
scope
.
appEvent
(
'show-dash-editor'
,
{
src
:
'app/partials/search.html'
});
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'ctrl+o'
,
function
()
{
var
current
=
scope
.
dashboard
.
sharedCrosshair
;
scope
.
dashboard
.
sharedCrosshair
=
!
current
;
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'ctrl+h'
,
function
()
{
var
current
=
scope
.
dashboard
.
hideControls
;
scope
.
dashboard
.
hideControls
=
!
current
;
...
...
src/app/services/dashboard/dashboardSrv.js
View file @
44f2a375
...
...
@@ -27,6 +27,7 @@ function (angular, $, kbn, _, moment) {
this
.
timezone
=
data
.
timezone
||
'browser'
;
this
.
editable
=
data
.
editable
===
false
?
false
:
true
;
this
.
hideControls
=
data
.
hideControls
||
false
;
this
.
sharedCrosshair
=
data
.
sharedCrosshair
||
true
;
this
.
rows
=
data
.
rows
||
[];
this
.
nav
=
data
.
nav
||
[];
this
.
time
=
data
.
time
||
{
from
:
'now-6h'
,
to
:
'now'
};
...
...
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