---
id: 587d7fa8367417b2b2512bc9
title: Update the Height of an Element Dynamically
required:
- src: 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js'
challengeType: 6
videoUrl: ''
localeTitle: Atualizar a Altura de um Elemento Dinamicamente
---
## Description
Os desafios anteriores cobriam como exibir dados de uma matriz e como adicionar classes CSS. Você pode combinar essas lições para criar um gráfico de barras simples. Há duas etapas para isso: 1) Criar uma div
para cada ponto de dados na matriz 2) Dar a cada div
uma altura dinâmica, usando uma função de retorno de chamada no método style()
que define a altura igual ao valor dos dados. definir um estilo usando uma função de retorno de chamada: selection.style("cssProperty", (d) => d)
## Instructions
Adicione o método style()
ao código no editor para definir a propriedade height
para cada elemento. Use uma função de retorno de chamada para retornar o valor do ponto de dados com a string "px" adicionada a ele.
## Tests
```yml
tests:
- text: O primeiro div
deve ter uma height
de 12 pixels.
testString: 'assert($("div").eq(0).css("height") == "12px", "The first div
should have a height
of 12 pixels.");'
- text: O segundo div
deve ter uma height
de 31 pixels.
testString: 'assert($("div").eq(1).css("height") == "31px", "The second div
should have a height
of 31 pixels.");'
- text: O terceiro div
deve ter uma height
de 22 pixels.
testString: 'assert($("div").eq(2).css("height") == "22px", "The third div
should have a height
of 22 pixels.");'
- text: O quarto div
deve ter uma height
de 17 pixels.
testString: 'assert($("div").eq(3).css("height") == "17px", "The fourth div
should have a height
of 17 pixels.");'
- text: O quinto div
deve ter uma height
de 25 pixels.
testString: 'assert($("div").eq(4).css("height") == "25px", "The fifth div
should have a height
of 25 pixels.");'
- text: O sexto div
deve ter uma height
de 18 pixels.
testString: 'assert($("div").eq(5).css("height") == "18px", "The sixth div
should have a height
of 18 pixels.");'
- text: O sétimo div
deve ter uma height
de 29 pixels.
testString: 'assert($("div").eq(6).css("height") == "29px", "The seventh div
should have a height
of 29 pixels.");'
- text: O oitavo div
deve ter uma height
de 14 pixels.
testString: 'assert($("div").eq(7).css("height") == "14px", "The eighth div
should have a height
of 14 pixels.");'
- text: O nono div
deve ter uma height
de 9 pixels.
testString: 'assert($("div").eq(8).css("height") == "9px", "The ninth div
should have a height
of 9 pixels.");'
```
## Challenge Seed
## Solution
```js
// solution required
```