Challenge: Add Tooltip to a Treemap

Can you implement a tooltip in a treemap that will show the name of the continent when we hover over the country in the treemap?

Problem statement

Add a tooltip to the treemap already drawn in the Drawing a Treemap lesson. The tooltip should show the name of the continent of the country over which the mouse has hovered.

Expected output

Expected output

Coding exercise

The problem is designed to check your understanding of the tooltip and treemap, so you are encouraged to solve it on your own. If you are completely stuck, then refer to the next lesson, which will explain the solution in detail.

Coding Exercise