Skip to content

Commit ada0563

Browse files
committed
Fix tooltip position
1 parent 3ffc5e7 commit ada0563

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

EDAV-assignment1.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ <h3>The Process</h3>
581581

582582
var color = ["#ddd", "#4C374C", "#967AA4", "#CCAFE8"];
583583
var lineColor = "#59DDAF";
584-
var posAdjust = 20;
584+
var posAdjust = -300;
585585

586586
var n = 4, // number of layers
587587
m = data.length, // number of samples per layer
@@ -676,7 +676,7 @@ <h3>The Process</h3>
676676
d3.select("#tooltip")
677677
// .style("left", (d3.event.pageX+10) + "px")
678678
.style("left", (d3.event.pageX+posAdjust) + "px")
679-
.style("top", (d3.event.pageY-10) + "px")
679+
.style("top", (d3.event.pageY+posAdjust) + "px")
680680
.select("#value")
681681
.text(tooltip);
682682
// .text(d.team + " - " + d.goals + " goals (" + d.y + " in round)");
@@ -846,7 +846,7 @@ <h3>The Process</h3>
846846
tooltip = d.year + " - " + d.champion + " - " + d.champGoals + " goals";
847847
d3.select("#tooltip")
848848
.style("left", (d3.event.pageX+posAdjust) + "px")
849-
.style("top", (d3.event.pageY-10) + "px")
849+
.style("top", (d3.event.pageY+posAdjust) + "px")
850850
.select("#value")
851851
.text(tooltip);
852852
// .text(d.team + " - " + d.goals + " goals (" + d.y + " in round)");

EDAV-assignment2.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ <h3>The Fifa Ranking</h3>
31513151
width = 1200 - margin.left,
31523152
height = 800 - margin.top,
31533153
padding = 80;
3154-
var posAdjust = 10;
3154+
var posAdjust = -300;
31553155
var minRankDiff = 0, maxRankDiff = 0;
31563156
var n = gamesData.length;
31573157

@@ -3412,7 +3412,7 @@ <h3>The Fifa Ranking</h3>
34123412
tooltip = d3.select("#tooltip")
34133413
// .style("left", (d3.event.pageX+10) + "px")
34143414
.style("left", (d3.event.pageX+posAdjust) + "px")
3415-
.style("top", (d3.event.pageY-10) + "px")
3415+
.style("top", (d3.event.pageY+posAdjust) + "px")
34163416
tooltip.select("#matchScore").text(matchScore);
34173417
tooltip.select("#matchDate").text(d.date);
34183418
tooltip.select("#matchLocation").text(d.loc);

0 commit comments

Comments
 (0)