---
id: 587d7faa367417b2b2512bd6
title: Add a Tooltip to a D3 Element
challengeType: 6
forumTopicId: 301470
localeTitle: Добавление всплывающей подсказки к элементу D3
---
## Description
Всплывающая подсказка показывает дополнительную информацию об элементе на странице, когда пользователь наводит курсор на этот элемент. Существует несколько способов добавления всплывающей подсказки к визуализации, эта задача использует элемент title
SVG. title
с методом text()
для динамического добавления данных в столбцы.
## Instructions
Добавляйте элемент title
под каждым rect
узлом. Затем вызовите метод text()
с функцией обратного вызова, чтобы текст отображал значение данных.
## Tests
```yml
tests:
- text: Your code should have 9 title
elements.
testString: assert($('title').length == 9);
- text: The first title
element should have tooltip text of 12.
testString: assert($('title').eq(0).text() == '12');
- text: The second title
element should have tooltip text of 31.
testString: assert($('title').eq(1).text() == '31');
- text: The third title
element should have tooltip text of 22.
testString: assert($('title').eq(2).text() == '22');
- text: The fourth title
element should have tooltip text of 17.
testString: assert($('title').eq(3).text() == '17');
- text: The fifth title
element should have tooltip text of 25.
testString: assert($('title').eq(4).text() == '25');
- text: The sixth title
element should have tooltip text of 18.
testString: assert($('title').eq(5).text() == '18');
- text: The seventh title
element should have tooltip text of 29.
testString: assert($('title').eq(6).text() == '29');
- text: The eighth title
element should have tooltip text of 14.
testString: assert($('title').eq(7).text() == '14');
- text: The ninth title
element should have tooltip text of 9.
testString: assert($('title').eq(8).text() == '9');
```
## Challenge Seed
## Solution
```html
// solution required
```