---
id: 587d7fa9367417b2b2512bcf
title: Dynamically Change the Height of Each Bar
required:
- src: 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js'
challengeType: 6
videoUrl: ''
localeTitle: Alterar dinamicamente a altura de cada barra
---
## Description
A altura de cada barra pode ser definida para o valor do ponto de dados na matriz, semelhante a como o valor x
foi definido dinamicamente. selection.attr ("propriedade", (d, i) => {
/ *
* d é o valor do ponto de dados
* i é o índice do ponto de dados na matriz
* /
})
## Instructions
Altere a função de retorno de chamada para o atributo height
para retornar os tempos de valor de dados 3. Nota
Lembre-se de que multiplicar todos os pontos de dados pela mesma constante escala os dados (como aumentar o zoom). Isso ajuda a ver as diferenças entre os valores das barras neste exemplo.
## Tests
```yml
tests:
- text: O primeiro rect
deve ter uma height
de 36.
testString: 'assert($("rect").eq(0).attr("height") == "36", "The first rect
should have a height
of 36.");'
- text: O segundo rect
deve ter uma height
de 93.
testString: 'assert($("rect").eq(1).attr("height") == "93", "The second rect
should have a height
of 93.");'
- text: O terceiro rect
deve ter uma height
de 66.
testString: 'assert($("rect").eq(2).attr("height") == "66", "The third rect
should have a height
of 66.");'
- text: O quarto rect
deve ter uma height
de 51.
testString: 'assert($("rect").eq(3).attr("height") == "51", "The fourth rect
should have a height
of 51.");'
- text: O quinto rect
deve ter uma height
de 75.
testString: 'assert($("rect").eq(4).attr("height") == "75", "The fifth rect
should have a height
of 75.");'
- text: O sexto rect
deve ter uma height
de 54.
testString: 'assert($("rect").eq(5).attr("height") == "54", "The sixth rect
should have a height
of 54.");'
- text: O sétimo rect
deve ter uma height
de 87.
testString: 'assert($("rect").eq(6).attr("height") == "87", "The seventh rect
should have a height
of 87.");'
- text: O oitavo rect
deve ter uma height
de 42.
testString: 'assert($("rect").eq(7).attr("height") == "42", "The eighth rect
should have a height
of 42.");'
- text: O nono rect
deve ter uma height
de 27.
testString: 'assert($("rect").eq(8).attr("height") == "27", "The ninth rect
should have a height
of 27.");'
```
## Challenge Seed
## Solution
```js
// solution required
```