D3 Scatter Plot - Strange Error

How is
tooltip.style("opacity", 0);
“not a function” in mouseout and mouseleave an error? I have a tooltip style tag in mouseout that isn’t flagged? Where are these different? I appreciate the help. Thank you.

My Codepen link is https://codepen.io/richardvannie/pen/ZEgrbdq

Hi @r7464946 , :wave:

Just so you know for future reference, it’s pretty difficult to read what you’re asking in your question:

  • I don’t know what you mean by " I have a tooltip style tag in mouseout that isn’t flagged?" is it a question?
  • “Where are these different”? Do you mean why are they different? And to what are you referring?

I’ll assume you want to know why tooltip.style is not a function…

Try logging tooltip to see what it is.
If it contains style , then log that too and see what it is.

    .on("mouseout", () => {
      console.log("Tooltip: ", tooltip); // what do you see here?
      console.log("Tooltip style: ", tooltip.style); // is this undefined? a function? something else? Does this throw an error?
      tooltip.style("opacity", 0).html("");
    })
    .on("mouseleave", () => {
      tooltip.style("opacity", 0).html("");
    });

Can you also write out the steps involved in running your code to reproduce the error? It is possible that by the time someone goes into your code that you might have fixed or changed it.

Thank you. You interpreted my question correctly. It was clear.

Your advice is helpful. Thanks again.

1 Like

Glad to hear it! Best of luck.