---
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: Cambiar dinámicamente la altura de cada barra
---
## Description
La altura de cada barra se puede establecer en el valor del punto de datos en la matriz, de manera similar a cómo se estableció dinámicamente el valor de x
. selection.attr ("propiedad", (d, i) => {
/ *
* d es el valor del punto de datos
* i es el índice del punto de datos en la matriz
* /
})
## Instructions
Cambie la función de devolución de llamada para que el atributo de height
devuelva el valor de los datos por 3. Nota
Recuerde que al multiplicar todos los puntos de datos por la misma constante, se escalan los datos (como hacer zoom). Ayuda a ver las diferencias entre los valores de barras en este ejemplo.
## Tests
```yml
tests:
- text: El primer rect
debe tener una height
de 36.
testString: 'assert($("rect").eq(0).attr("height") == "36", "The first rect
should have a height
of 36.");'
- text: El segundo rect
debe tener una height
de 93.
testString: 'assert($("rect").eq(1).attr("height") == "93", "The second rect
should have a height
of 93.");'
- text: El tercer rect
debe tener una height
de 66.
testString: 'assert($("rect").eq(2).attr("height") == "66", "The third rect
should have a height
of 66.");'
- text: El cuarto rect
debe tener una height
de 51.
testString: 'assert($("rect").eq(3).attr("height") == "51", "The fourth rect
should have a height
of 51.");'
- text: El quinto rect
debe tener una height
de 75.
testString: 'assert($("rect").eq(4).attr("height") == "75", "The fifth rect
should have a height
of 75.");'
- text: El sexto rect
debe tener una height
de 54.
testString: 'assert($("rect").eq(5).attr("height") == "54", "The sixth rect
should have a height
of 54.");'
- text: El séptimo rect
debe tener una height
de 87.
testString: 'assert($("rect").eq(6).attr("height") == "87", "The seventh rect
should have a height
of 87.");'
- text: El octavo rect
debe tener una height
de 42.
testString: 'assert($("rect").eq(7).attr("height") == "42", "The eighth rect
should have a height
of 42.");'
- text: El noveno rect
debe tener una 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
```