coronavizdata/static/app/interactive-axis.js
// function used for updating circles group with new tooltip
function used for updating circles group with new tooltip
function used for updating circles group with new tooltip
function updateToolTip(chosenXAxis, circlesGroup) {
  if (chosenXAxis === "numConfirmed") {
    var label = "Confirmed:";
  }
  else {
    var label = "Recovered";
  }
  var toolTip = d3.tip()
    .attr("class", "tooltip")
    .offset([80, -60])
    .html(function(d) {
      return (`${d.country}<hr class="border-success m-0">${label} ${format(d[chosenXAxis])}`);
    });
  circlesGroup.call(toolTip);
  circlesGroup.on("mouseover", function(data) {
    toolTip.show(data);
  })
    .on("mouseout", function(data, index) {
      toolTip.hide(data);
    });
  return circlesGroup;
}
function updateToolTip ( chosenXAxis , circlesGroup ) { if ( chosenXAxis === "numConfirmed" ) { var label = "Confirmed:" ; } else { var label = "Recovered" ; } var toolTip = d3 . tip ( ) . attr ( "class" , "tooltip" ) . offset ( [ 80 , - 60 ] ) . html ( function ( d ) { return ( ` ${ d . country } ${ label } ${ format ( d [ chosenXAxis ] ) } ` ) ; } ) ; circlesGroup . call ( toolTip ) ; circlesGroup . on ( "mouseover" , function ( data ) { toolTip . show ( data ) ; } ) . on ( "mouseout" , function ( data , index ) { toolTip . hide ( data ) ; } ) ; return circlesGroup ; }
function used for updating circles group with new tooltip
function used for updating circles group with new tooltip
// onmouseout event