function updateToolTip(chosenXAxis, chosenYAxis, circlesGroup) {
  
    var x_label;
    var y_label;
    //conditionals for X axis 
    if (chosenXAxis === "poverty") {
      x_label = "Poverty: ";
    }
    else if (chosenXAxis === "age") {
        x_label = "Age: ";
      }
    else {
      x_label = "Income: ";
    }

    //conditions for Y axis 
    if (chosenYAxis === "healthcare"){
      y_label = "Lacks Healthcare (%): ";
    }

    else if (chosenYAxis == "smokes"){
      y_label = "Smokes (%): "
    }
    else {
      y_label = "Obesity(%): "
    }
  
    var toolTip = d3.tip()
      .attr("class", "tooltip")
      .offset([80, -60])
      .html(function(d) {
        return (`${d.abbr}<br>${x_label} ${d[chosenXAxis]} <br> ${y_label} ${d[chosenYAxis]}`);
      });
  
    circlesGroup.call(toolTip);
  
    circlesGroup.on("mouseover", function(data) {
      toolTip.show(data);
    })
      // onmouseout event
      .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
function used for updating circles group with new tooltip
function updateToolTip(chosenXAxis, chosenYAxis, circlesGroup) {
    var x_label;
    var y_label;
    if (chosenXAxis === "poverty") {
      x_label = "Poverty: ";
    }
    else if (chosenXAxis === "age") {
        x_label = "Age: ";
      }
    else {
      x_label = "Income: ";
    }
    if (chosenYAxis === "healthcare"){
      y_label = "Lacks Healthcare (%): ";
    }
    else if (chosenYAxis == "smokes"){
      y_label = "Smokes (%): "
    }
    else {
      y_label = "Obesity(%): "
    }
    var toolTip = d3.tip()
      .attr("class", "tooltip")
      .offset([80, -60])
      .html(function(d) {
        return (`${d.abbr}<br>${x_label} ${d[chosenXAxis]} <br> ${y_label} ${d[chosenYAxis]}`);
      });
    circlesGroup.call(toolTip);
    circlesGroup.on("mouseover", function(data) {
      toolTip.show(data);
    })
      .on("mouseout", function(data, index) {
        toolTip.hide(data);
      });
    return circlesGroup;
}
function updateToolTip ( chosenXAxis , chosenYAxis , circlesGroup ) { var x_label ; var y_label ; if ( chosenXAxis === "poverty" ) { x_label = "Poverty: " ; } else if ( chosenXAxis === "age" ) { x_label = "Age: " ; } else { x_label = "Income: " ; } if ( chosenYAxis === "healthcare" ) { y_label = "Lacks Healthcare (%): " ; } else if ( chosenYAxis == "smokes" ) { y_label = "Smokes (%): " } else { y_label = "Obesity(%): " } var toolTip = d3 . tip ( ) . attr ( "class" , "tooltip" ) . offset ( [ 80 , - 60 ] ) . html ( function ( d ) { return ( ` ${ d . abbr } ${ x_label } ${ d [ chosenXAxis ] } ${ y_label } ${ d [ chosenYAxis ] } ` ) ; } ) ; 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
//conditionals for X axis  //conditions for Y axis  // onmouseout event