2019-04-09 11:01:39 -07:00
# plot Bar Graph
2016-03-25 16:47:20 -07:00
2019-04-09 11:01:39 -07:00
Display a bar graph for a number value.
2016-03-25 16:47:20 -07:00
```sig
led.plotBarGraph(2, 20);
```
2019-04-09 11:01:39 -07:00
A bar graph is a kind of chart that shows numbers as lines with different lengths.
2017-09-07 13:42:08 -07:00
## Parameters
2016-03-25 16:47:20 -07:00
2019-04-09 11:01:39 -07:00
* **value**: a [number ](/types/number ) that is the value of what you
2016-07-18 11:14:51 -07:00
are measuring or trying to show. For example, if you are measuring
2016-11-01 10:42:42 -07:00
the temperature of ice with the @boardname @, ``value`` might be ` 0`
2019-04-09 11:01:39 -07:00
if the temperature is 0 degrees Celsius.
* **high**: a [number ](/types/number ) that is the highest
possible number (maximum) that the **value** parameter can be. The lines in the bar graph will reach their highest point when **value** reaches this number. If **high** is `0` , then the largest value recently plotted is used as the maximum.
2016-03-25 16:47:20 -07:00
2017-09-07 13:42:08 -07:00
## Example: chart acceleration
2016-03-25 16:47:20 -07:00
2019-04-09 11:01:39 -07:00
Show a bar graph of the [acceleration ](/reference/input/acceleration )
2016-11-01 17:44:37 -07:00
in the `x` direction of the @boardname @.
The @boardname @'s `x` direction is from left to right (or right to left).
2019-04-09 11:01:39 -07:00
The faster you move the @boardname @ in this direction,
the taller the lines in the bar graph will be. The **high** paramter is `1023` which sets the highest possible value of acceleration to show.
2016-05-23 16:21:08 -07:00
2016-03-25 16:47:20 -07:00
```blocks
basic.forever(() => {
let a = input.acceleration(Dimension.X);
led.plotBarGraph(a, 1023)
})
```
2017-09-07 13:42:08 -07:00
## See also
2016-03-25 16:47:20 -07:00
2016-04-13 08:27:45 -07:00
[brightness ](/reference/led/brightness ), [fade in ](/reference/led/fade-in ), [fade out ](/reference/led/fade-out ), [LED screen ](/device/screen ), [stop animation ](/reference/led/stop-animation )
2016-03-25 16:47:20 -07:00