I'm really struggling with this concept and could use some guidance. My goal is to monitor when data is fetched, but I seem to have confused the process. Here's what I've tried so far: Using d3.tsv for an ajax request.
var test = Rx.Observable.just(
d3.tsv("https://gist.githubusercontent.com/mbostock/3885304/raw/37bd91278846c053188a130a01770cddff023590/data.tsv",
function(d) {
return {
letter: d.letter,
frequency: +d.frequency
};
},
function(error, rows) {
console.log('mytest2',rows);
}
)
);
var observer = Rx.Observer.create(
function (x) { console.log('onNext: %s', x); },
function (e) { console.log('onError: %s', e); },
function () { console.log('onCompleted'); });
var subscription = test.subscribe(observer);
Although the ajax request technically works, all of the Observable functions occur before the data actually arrives. How can I set it up so that my 'onNext' log displays the data, rather than only receiving it inside the d3.tsv function?