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
a04d531d
Unverified
Commit
a04d531d
authored
Aug 23, 2018
by
Marcus Efraimsson
Committed by
GitHub
Aug 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12999 from alexanderzobnin/fix-12486-cherry-pick
Heatmap: fix tooltip and crosshair in firefox
parents
4db480ad
8dc16755
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
29 deletions
+34
-29
public/app/plugins/panel/heatmap/heatmap_tooltip.ts
+9
-19
public/app/plugins/panel/heatmap/rendering.ts
+25
-10
No files found.
public/app/plugins/panel/heatmap/heatmap_tooltip.ts
View file @
a04d531d
...
@@ -28,21 +28,9 @@ export class HeatmapTooltip {
...
@@ -28,21 +28,9 @@ export class HeatmapTooltip {
this
.
mouseOverBucket
=
false
;
this
.
mouseOverBucket
=
false
;
this
.
originalFillColor
=
null
;
this
.
originalFillColor
=
null
;
elem
.
on
(
'mouseover'
,
this
.
onMouseOver
.
bind
(
this
));
elem
.
on
(
'mouseleave'
,
this
.
onMouseLeave
.
bind
(
this
));
elem
.
on
(
'mouseleave'
,
this
.
onMouseLeave
.
bind
(
this
));
}
}
onMouseOver
(
e
)
{
if
(
!
this
.
panel
.
tooltip
.
show
||
!
this
.
scope
.
ctrl
.
data
||
_
.
isEmpty
(
this
.
scope
.
ctrl
.
data
.
buckets
))
{
return
;
}
if
(
!
this
.
tooltip
)
{
this
.
add
();
this
.
move
(
e
);
}
}
onMouseLeave
()
{
onMouseLeave
()
{
this
.
destroy
();
this
.
destroy
();
}
}
...
@@ -81,11 +69,15 @@ export class HeatmapTooltip {
...
@@ -81,11 +69,15 @@ export class HeatmapTooltip {
let
{
xBucketIndex
,
yBucketIndex
}
=
this
.
getBucketIndexes
(
pos
,
data
);
let
{
xBucketIndex
,
yBucketIndex
}
=
this
.
getBucketIndexes
(
pos
,
data
);
if
(
!
data
.
buckets
[
xBucketIndex
]
||
!
this
.
tooltip
)
{
if
(
!
data
.
buckets
[
xBucketIndex
])
{
this
.
destroy
();
this
.
destroy
();
return
;
return
;
}
}
if
(
!
this
.
tooltip
)
{
this
.
add
();
}
let
boundBottom
,
boundTop
,
valuesNumber
;
let
boundBottom
,
boundTop
,
valuesNumber
;
let
xData
=
data
.
buckets
[
xBucketIndex
];
let
xData
=
data
.
buckets
[
xBucketIndex
];
// Search in special 'zero' bucket also
// Search in special 'zero' bucket also
...
@@ -158,13 +150,12 @@ export class HeatmapTooltip {
...
@@ -158,13 +150,12 @@ export class HeatmapTooltip {
}
}
getBucketIndexes
(
pos
,
data
)
{
getBucketIndexes
(
pos
,
data
)
{
const
xBucketIndex
=
this
.
getXBucketIndex
(
pos
.
offsetX
,
data
);
const
xBucketIndex
=
this
.
getXBucketIndex
(
pos
.
x
,
data
);
const
yBucketIndex
=
this
.
getYBucketIndex
(
pos
.
offsetY
,
data
);
const
yBucketIndex
=
this
.
getYBucketIndex
(
pos
.
y
,
data
);
return
{
xBucketIndex
,
yBucketIndex
};
return
{
xBucketIndex
,
yBucketIndex
};
}
}
getXBucketIndex
(
offsetX
,
data
)
{
getXBucketIndex
(
x
,
data
)
{
let
x
=
this
.
scope
.
xScale
.
invert
(
offsetX
-
this
.
scope
.
yAxisWidth
).
valueOf
();
// First try to find X bucket by checking x pos is in the
// First try to find X bucket by checking x pos is in the
// [bucket.x, bucket.x + xBucketSize] interval
// [bucket.x, bucket.x + xBucketSize] interval
let
xBucket
=
_
.
find
(
data
.
buckets
,
bucket
=>
{
let
xBucket
=
_
.
find
(
data
.
buckets
,
bucket
=>
{
...
@@ -173,8 +164,7 @@ export class HeatmapTooltip {
...
@@ -173,8 +164,7 @@ export class HeatmapTooltip {
return
xBucket
?
xBucket
.
x
:
getValueBucketBound
(
x
,
data
.
xBucketSize
,
1
);
return
xBucket
?
xBucket
.
x
:
getValueBucketBound
(
x
,
data
.
xBucketSize
,
1
);
}
}
getYBucketIndex
(
offsetY
,
data
)
{
getYBucketIndex
(
y
,
data
)
{
let
y
=
this
.
scope
.
yScale
.
invert
(
offsetY
-
this
.
scope
.
chartTop
);
if
(
data
.
tsBuckets
)
{
if
(
data
.
tsBuckets
)
{
return
Math
.
floor
(
y
);
return
Math
.
floor
(
y
);
}
}
...
...
public/app/plugins/panel/heatmap/rendering.ts
View file @
a04d531d
...
@@ -69,6 +69,7 @@ export class HeatmapRenderer {
...
@@ -69,6 +69,7 @@ export class HeatmapRenderer {
this
.
ctrl
.
events
.
on
(
'render'
,
this
.
onRender
.
bind
(
this
));
this
.
ctrl
.
events
.
on
(
'render'
,
this
.
onRender
.
bind
(
this
));
this
.
ctrl
.
tickValueFormatter
=
this
.
tickValueFormatter
.
bind
(
this
);
this
.
ctrl
.
tickValueFormatter
=
this
.
tickValueFormatter
.
bind
(
this
);
/////////////////////////////
/////////////////////////////
// Selection and crosshair //
// Selection and crosshair //
/////////////////////////////
/////////////////////////////
...
@@ -678,9 +679,17 @@ export class HeatmapRenderer {
...
@@ -678,9 +679,17 @@ export class HeatmapRenderer {
}
}
}
}
getEventOffset
(
event
)
{
const
elemOffset
=
this
.
$heatmap
.
offset
();
const
x
=
Math
.
floor
(
event
.
clientX
-
elemOffset
.
left
);
const
y
=
Math
.
floor
(
event
.
clientY
-
elemOffset
.
top
);
return
{
x
,
y
};
}
onMouseDown
(
event
)
{
onMouseDown
(
event
)
{
const
offset
=
this
.
getEventOffset
(
event
);
this
.
selection
.
active
=
true
;
this
.
selection
.
active
=
true
;
this
.
selection
.
x1
=
event
.
offsetX
;
this
.
selection
.
x1
=
offset
.
x
;
this
.
mouseUpHandler
=
()
=>
{
this
.
mouseUpHandler
=
()
=>
{
this
.
onMouseUp
();
this
.
onMouseUp
();
...
@@ -718,23 +727,25 @@ export class HeatmapRenderer {
...
@@ -718,23 +727,25 @@ export class HeatmapRenderer {
return
;
return
;
}
}
const
offset
=
this
.
getEventOffset
(
event
);
if
(
this
.
selection
.
active
)
{
if
(
this
.
selection
.
active
)
{
// Clear crosshair and tooltip
// Clear crosshair and tooltip
this
.
clearCrosshair
();
this
.
clearCrosshair
();
this
.
tooltip
.
destroy
();
this
.
tooltip
.
destroy
();
this
.
selection
.
x2
=
this
.
limitSelection
(
event
.
offsetX
);
this
.
selection
.
x2
=
this
.
limitSelection
(
offset
.
x
);
this
.
drawSelection
(
this
.
selection
.
x1
,
this
.
selection
.
x2
);
this
.
drawSelection
(
this
.
selection
.
x1
,
this
.
selection
.
x2
);
}
else
{
}
else
{
this
.
emitGraphHoverEvent
(
event
);
const
pos
=
this
.
getEventPos
(
event
,
offset
);
this
.
drawCrosshair
(
event
.
offsetX
);
this
.
drawCrosshair
(
offset
.
x
);
this
.
tooltip
.
show
(
event
,
this
.
data
);
this
.
tooltip
.
show
(
pos
,
this
.
data
);
this
.
emitGraphHoverEvent
(
pos
);
}
}
}
}
emitGraphHoverEvent
(
even
t
)
{
getEventPos
(
event
,
offse
t
)
{
let
x
=
this
.
xScale
.
invert
(
event
.
offsetX
-
this
.
yAxisWidth
).
valueOf
();
let
x
=
this
.
xScale
.
invert
(
offset
.
x
-
this
.
yAxisWidth
).
valueOf
();
let
y
=
this
.
yScale
.
invert
(
event
.
offsetY
);
let
y
=
this
.
yScale
.
invert
(
offset
.
y
-
this
.
chartTop
);
let
pos
=
{
let
pos
=
{
pageX
:
event
.
pageX
,
pageX
:
event
.
pageX
,
pageY
:
event
.
pageY
,
pageY
:
event
.
pageY
,
...
@@ -743,11 +754,15 @@ export class HeatmapRenderer {
...
@@ -743,11 +754,15 @@ export class HeatmapRenderer {
y
:
y
,
y
:
y
,
y1
:
y
,
y1
:
y
,
panelRelY
:
null
,
panelRelY
:
null
,
offset
,
};
};
// Set minimum offset to prevent showing legend from another panel
return
pos
;
pos
.
panelRelY
=
Math
.
max
(
event
.
offsetY
/
this
.
height
,
0.001
);
}
emitGraphHoverEvent
(
pos
)
{
// Set minimum offset to prevent showing legend from another panel
pos
.
panelRelY
=
Math
.
max
(
pos
.
offset
.
y
/
this
.
height
,
0.001
);
// broadcast to other graph panels that we are hovering
// broadcast to other graph panels that we are hovering
appEvents
.
emit
(
'graph-hover'
,
{
pos
:
pos
,
panel
:
this
.
panel
});
appEvents
.
emit
(
'graph-hover'
,
{
pos
:
pos
,
panel
:
this
.
panel
});
}
}
...
...
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