lead.js icon indicating copy to clipboard operation
lead.js copied to clipboard

interactive graph

Open also opened this issue 12 years ago • 1 comments

drag left and right to change time period

also avatar Jun 16 '13 20:06 also

This uses brushes, rather than dragging the graph itself:

params = new Bacon.Model {}
brush = new Bacon.Model()
cursor = new Bacon.Model()
button = input.button('update')

target = randomWalk 'random walk'

params.addSource brush.sampledBy(button).map (extent) ->
  if extent?
    from: moment(extent[0]).unix(), until: moment(extent[1]).unix()
  else
     Bacon.once {}

liveData =
  params.flatMapLatest (params) ->
    Bacon.fromPromise get_data target, params

options {
  cursor
  brush
  height: 200
}
graph liveData, options()
graph target, from: '-1w'

also avatar Sep 01 '14 15:09 also