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
8c02a7bd
Commit
8c02a7bd
authored
Dec 16, 2015
by
carl bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'relative' of
https://github.com/utkarshcmu/grafana
into utkarshcmu-relative
parents
48539c85
e0b58577
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
public/app/features/dashboard/dashboardSrv.js
+18
-3
public/app/plugins/panels/graph/graph.tooltip.js
+13
-7
No files found.
public/app/features/dashboard/dashboardSrv.js
View file @
8c02a7bd
...
...
@@ -214,9 +214,8 @@ function (angular, $, _, moment) {
};
p
.
formatDate
=
function
(
date
,
format
)
{
if
(
!
moment
.
isMoment
(
date
))
{
date
=
moment
(
date
);
}
date
=
this
.
checkDate
(
date
);
format
=
format
||
'YYYY-MM-DD HH:mm:ss'
;
...
...
@@ -225,6 +224,22 @@ function (angular, $, _, moment) {
moment
.
utc
(
date
).
format
(
format
);
};
p
.
getRelativeTime
=
function
(
date
)
{
date
=
this
.
checkDate
(
date
);
return
this
.
timezone
===
'browser'
?
moment
(
date
).
fromNow
()
:
moment
.
utc
(
date
).
fromNow
();
};
p
.
checkDate
=
function
(
date
)
{
if
(
!
moment
.
isMoment
(
date
))
{
date
=
moment
(
date
);
}
return
date
;
};
p
.
_updateSchema
=
function
(
old
)
{
var
i
,
j
,
k
;
var
oldVersion
=
this
.
schemaVersion
;
...
...
public/app/plugins/panels/graph/graph.tooltip.js
View file @
8c02a7bd
...
...
@@ -31,8 +31,8 @@ function ($) {
return
j
-
1
;
};
this
.
showTooltip
=
function
(
titl
e
,
innerHtml
,
pos
)
{
var
body
=
'<div class="graph-tooltip small"><div class="graph-tooltip-time">'
+
title
+
'
</div> '
;
this
.
showTooltip
=
function
(
absoluteTime
,
relativeTim
e
,
innerHtml
,
pos
)
{
var
body
=
'<div class="graph-tooltip small"><div class="graph-tooltip-time">'
+
absoluteTime
+
'<br>('
+
relativeTime
+
')
</div> '
;
body
+=
innerHtml
+
'</div>'
;
$tooltip
.
html
(
body
).
place_tt
(
pos
.
pageX
+
20
,
pos
.
pageY
);
};
...
...
@@ -106,7 +106,7 @@ function ($) {
var
plot
=
elem
.
data
().
plot
;
var
plotData
=
plot
.
getData
();
var
seriesList
=
getSeriesFn
();
var
group
,
value
,
timestamp
,
hoverInfo
,
i
,
series
,
seriesHtml
;
var
group
,
value
,
absoluteTime
,
relativeTime
,
hoverInfo
,
i
,
series
,
seriesHtml
;
if
(
dashboard
.
sharedCrosshair
){
scope
.
appEvent
(
'setCrosshair'
,
{
pos
:
pos
,
scope
:
scope
});
...
...
@@ -122,7 +122,9 @@ function ($) {
var
seriesHoverInfo
=
self
.
getMultiSeriesPlotHoverInfo
(
plotData
,
pos
);
seriesHtml
=
''
;
timestamp
=
dashboard
.
formatDate
(
seriesHoverInfo
.
time
);
relativeTime
=
dashboard
.
getRelativeTime
(
seriesHoverInfo
.
time
);
absoluteTime
=
dashboard
.
formatDate
(
seriesHoverInfo
.
time
);
for
(
i
=
0
;
i
<
seriesHoverInfo
.
length
;
i
++
)
{
hoverInfo
=
seriesHoverInfo
[
i
];
...
...
@@ -132,6 +134,7 @@ function ($) {
}
series
=
seriesList
[
i
];
value
=
series
.
formatValue
(
hoverInfo
.
value
);
seriesHtml
+=
'<div class="graph-tooltip-list-item"><div class="graph-tooltip-series-name">'
;
...
...
@@ -140,7 +143,7 @@ function ($) {
plot
.
highlight
(
i
,
hoverInfo
.
hoverIndex
);
}
self
.
showTooltip
(
timestamp
,
seriesHtml
,
pos
);
self
.
showTooltip
(
absoluteTime
,
relativeTime
,
seriesHtml
,
pos
);
}
// single series tooltip
else
if
(
item
)
{
...
...
@@ -156,10 +159,13 @@ function ($) {
}
value
=
series
.
formatValue
(
value
);
timestamp
=
dashboard
.
formatDate
(
item
.
datapoint
[
0
]);
relativeTime
=
dashboard
.
getRelativeTime
(
item
.
datapoint
[
0
]);
absoluteTime
=
dashboard
.
formatDate
(
item
.
datapoint
[
0
]);
group
+=
'<div class="graph-tooltip-value">'
+
value
+
'</div>'
;
self
.
showTooltip
(
timestamp
,
group
,
pos
);
self
.
showTooltip
(
absoluteTime
,
relativeTime
,
group
,
pos
);
}
// no hit
else
{
...
...
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