cns-iu / ngx-dino

A visualization framework and component library for Angular 7+
MIT License
5 stars 0 forks source link

stream.pipe is not a function #69

Open CryHenry opened 5 years ago

CryHenry commented 5 years ago

Hi,

Looks like you've put a heap of work into this, but it is seriously lacking documentation. I'm trying to use the force-network graph, but I am getting this error. As I don't know the data format expected by component, I suspect that my node objects are not conforming to the components expected data format.

CytoComponent.ngfactory.js:8 ERROR TypeError: stream.pipe is not a function at getCache (vendor.js:132909) at DataProcessorService.createProcessor (vendor.js:132928) at ForceNetworkDataService.fetchData (vendor.js:133510) at ForceNetworkComponent.updateStreamProcessor (vendor.js:133681) at ForceNetworkComponent.ngOnChanges (vendor.js:133631) at checkAndUpdateDirectiveInline (vendor.js:75839) at checkAndUpdateNodeInline (vendor.js:87177) at checkAndUpdateNode (vendor.js:87116) at debugCheckAndUpdateNode (vendor.js:88138) at debugCheckDirectivesFn (vendor.js:88081)

bherr2 commented 5 years ago

Hi @CryHenry! Apologies for the lack of documentation. The node and edge streams take an Observable that returns a RawChangeSet. If you have a simple flat data array, you can get it into the right form by doing this:

import { RawChangeSet } from '@ngx-dino/core';
import { Observable, of } from 'rxjs';

function asObservable<T = any>(data: T[]): Observable<RawChangeSet<T>> {
    return of(RawChangeSet.fromArray(data));
}

It may be a little hard to follow, but our demo app shows how we used it to create the demo. Two relevant directories are:

CryHenry commented 5 years ago

Thanks, I'll give it a try.