Published
Edited
Oct 2, 2019
1 fork
1 star
Insert cell
Insert cell
color$ = obs
.merge(load$,
obs.combineLatest(input$(red), input$(green), input$(blue)))
.do(updateUI)
.share()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
load$ = obs
.fromEvent(load, 'click')
.map(x => load.value)
.debounceTime(100)
.flatMap( _ => threeRandomNumbers )
.bufferCount(3)
Insert cell
threeRandomNumbers = obs.range(1,3).map(util.random).map(x => 25 * x)
Insert cell
input$ = (input) => obs
.fromEvent(input, 'input')
.throttleTime(100)
.startWith(input.value)
.map(x => Number(input.value))
Insert cell
updateUI = color => {
red.value = color[0]
green.value = color[1]
blue.value = color[2]
}
Insert cell
rgb = color => `rgb(${color[0]},${color[1]},${color[2]})`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more