Skip to content

Commit 8560652

Browse files
committed
New styling for tooltip box, taking into account client widht and height
1 parent 815c892 commit 8560652

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

app/scripts/scatter.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1744,12 +1744,23 @@ scatterPlot.prototype.renderdots = function renderdots(parameter){
17441744
}
17451745
values = '<br>'+values;
17461746

1747+
var topPos = d3.event.pageY + 3;
1748+
var clientHeight = d3.select('body').node().getBoundingClientRect().height;
1749+
if (topPos+300 > clientHeight){
1750+
topPos = topPos - 300;
1751+
}
1752+
var leftPos = (d3.event.pageX + 10);
1753+
var clientWidth = d3.select('body').node().getBoundingClientRect().width;
1754+
if(leftPos+240 > clientWidth ){
1755+
leftPos = leftPos - 265;
1756+
}
1757+
17471758
self.tooltip.transition()
17481759
.duration(100)
17491760
.style("display", "block");
17501761
self.tooltip.html(values)
1751-
.style("left", (d3.event.pageX + 10) + "px")
1752-
.style("top", (d3.event.pageY + 3) + "px");
1762+
.style("left", leftPos + "px")
1763+
.style("top", topPos + "px");
17531764

17541765
// Add close button
17551766
var closeArea = self.tooltip.append('text')

app/styles/analytics.scss

+25
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,33 @@ svg {
3333
border-radius: 6px;
3434
display: none;
3535
padding: 5px;
36+
max-height: 300px;
37+
width: 240px;
38+
overflow-y: scroll;
39+
z-index: 1015;
3640
}
3741

42+
// Scrollbar style for tooltib
43+
44+
.AV-point-tooltip::-webkit-scrollbar-track
45+
{
46+
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
47+
background-color: #F5F5F5;
48+
}
49+
50+
.AV-point-tooltip::-webkit-scrollbar
51+
{
52+
width: 10px;
53+
background-color: #F5F5F5;
54+
}
55+
56+
.AV-point-tooltip::-webkit-scrollbar-thumb
57+
{
58+
background-color: #000000;
59+
border: 2px solid #555555;
60+
}
61+
62+
3863

3964
.legend {
4065
font-size: 18px;

lib/scripts/av.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/styles/av.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)