app.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 === "poverty") {
      var label = "Poverty";
    }
    else {
      var label = "Age";
    }
    var toolTip = d3.tip()
      .attr("class", "tooltip")
      .offset([80, -60])
      .html(function(d) {
        return (`State: ${d.state}<br>${label}: ${d[chosenXAxis]}<br> Healthcare: ${d.healthcare}`);
      });
    circlesGroup.call(toolTip);
    circlesGroup.on("mouseover", function(data) {
      toolTip.show(data, this);
    })
      .on("mouseout", function(data, index) {
        toolTip.hide(data, this);
      });
    return circlesGroup;
  }
function updateToolTip ( chosenXAxis , circlesGroup ) { if ( chosenXAxis === "poverty" ) { var label = "Poverty" ; } else { var label = "Age" ; } var toolTip = d3 . tip ( ) . attr ( "class" , "tooltip" ) . offset ( [ 80 , - 60 ] ) . html ( function ( d ) { return ( ` ${ d . state } ${ label } ${ d [ chosenXAxis ] } ${ d . healthcare } ` ) ; } ) ; circlesGroup . call ( toolTip ) ; circlesGroup . on ( "mouseover" , function ( data ) { toolTip . show ( data , this ) ; } ) . on ( "mouseout" , function ( data , index ) { toolTip . hide ( data , this ) ; } ) ; return circlesGroup ; }
function used for updating circles group with new tooltip
function used for updating circles group with new tooltip
// return ("<strong>Frequency:</strong>" ) // REFERENCE:   return "<strong>Frequency:</strong> <span style='color:red'>" + d.frequency + "</span>"; // onmouseout event