This example demonstrates how to build a nested hierarchy from a streaming datasource.
Groups in the hierarchy are generated and sorted "on demand" as they are pulled from the data$ Observable.
Rx.Observable.groupBy() produces GroupedObservables which are scanned into arrays and then combined using flatMapLatest(Rx.Observable.combineLatest).
(Note: It's important to shareReplay the GroupedObservables)
This example also uses babel-standalone to enable in-browser ES6 features.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.min.js
https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.7/rx.all.min.js
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.7.4/babel.min.js