Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second part of exercise #7

Open
wants to merge 5 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ <h1>Shaded Map of World</h1>
<p>Your challenge. Create a shaded map of the world from some data about each country, get it to display and also dynamically update other content on this page.</p>
</section>

<section id="map"></section>
<section id="info"></section>

<section id="map"></section>

</body>
<script src="js/map.js"></script>

Expand Down
8 changes: 7 additions & 1 deletion map/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ var country = svg.selectAll(".country").data(countries);
// Respond to mouse actions
country
.on("mousemove", function(d,i) {
})
d3.select(this).style("stroke","black")
.style("stroke-width","1.2px")
$('#info').html("<h2>"+d.name+"</h2>Population:<span class='population'>"+d.value.toString().replace(/\B(?=\d{3})+(?!\d)/g,",")+"</span>");
}
)
.on("click", function(d,i) {
})
.on("mouseout", function(d,i) {
d3.select(this).style("stroke","#666")
.style("stroke-width","0.4px")
});

}