# graphistryJS

Function that wraps an IFrame as an Observable GraphistryState - other methods in this library can be piped with it

Parameters:

Name | Type | Description
--- | --- | ---
`IFrame` | Object | An IFrame that hosts a Graphistry visualization.

Source:
  - index.js, line 1486

Returns:

GraphistryState - Observable that emits GraphistryState (must .subscribe() to start listening)

Example

    <iframe id="viz" src="https://hub.graphistry.com/graph/graph.html?dataset=Miserables" />
    <script>
    document.addEventListener("DOMContentLoaded", function () {

        graphistryJS(document.getElementById('viz'))
           .pipe(
              tap((g) => {
                console.log('iframe ready; opening filters, pausing, then adding columns');
                document.getElementById('controls').style.opacity=1.0);
                window.g = g;
              }),
              openFilters,
              delay(5000),
              switchMap((g) => {
                console.log('filters opened & delayed; adding columns');
                const columns = [
                    ['edge', 'highways', [66, 101, 280], 'number'],
                    ['point', 'theme parks', ['six flags', 'disney world', 'great america'], 'string']
                ];
                return (
                     forkJoin(columns.map(([type, name, values, type]) => addColumn(type, name, values, type)))
                     .pipe(map(() => g)))
           })
           .subscribe(
               (g) => { console.log('event', g); },
               (err) => { console.log('error', err); },
              () => { console.log('all done'); }
            });
    </script>