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