function render() {
update_dots
.attr("cx", function (d) {
return project(d.geometry[1], d.geometry[0]).x;
})
.attr("cy", function (d) {
return project(d.geometry[1], d.geometry[0]).y;
})
.on('mouseover', function(event, d) {
d3.select('#tooltip').html(d.name + "<br>Rating: "
+ d.rating).transition().duration(200).style('opacity', 1);
d3.select(this)
.style("fill", "black")
.style("opacity", 1);
if (d.rating >= 4.8) {
d3.select(this)
.style("fill","green");
}
if (d.rating < 4) {
d3.select(this)
.style("fill","red");
}
})
.on('mouseout', function(event, d) {
map.getCanvasContainer().style.cursor = '';
d3.select('#tooltip').style('opacity', 0);
d3.select(this)
.style("stroke", "black")
.style("stroke-width", "0.5")
.style("opacity", 1)
.style("fill", update_intersection());
})
.on('mousemove', function(event, d) {
map.getCanvasContainer().style.cursor = 'pointer';
d3.select('#tooltip').style("top", (event.pageY+25)+"px").style("left", (event.pageX)+"px");
});
d3.selectAll("#dot").raise()
}