5.1.1 • Published 1 month ago

@graphistry/client-api v5.1.1

Weekly downloads
19
License
Apache-2.0
Repository
github
Last release
1 month ago

Graphistry's JavaScript Client API

Graphistry's client-side interactions API makes it easy for developers to interact with embedded graph visualizations.

Installation

The JS package supports commonjs, esm, and iffe formats. See package.json for dist/ folder contents.

The rxjs version is an unpinned peer dependency:

  • The bundled versions dist/index.{cjs,esm,iife}.min.js keep rxjs as an external package
  • The bundled versions dist/index.full.{cjs,esm,iife}.min.js include it
  • Use dist/index.full.iife.min.js for <script src="..."/> tags

Docs

  1. To use this interactions API, call GraphistryJS with an IFrame containing a graphistry vizualization
  2. See client-api (interactive storybook docs)
  3. Refer to the Graphistry class for a list of the methods currently supported. More on the way!
  4. Refer to example in GraphistryJS

See also the @graphistry/client-api-react React docs

Import

Depending on the module format, you may use import, require, and window.GraphistryModule:

const G = GraphistryModule;
const g = G.graphistryJS(elt);
import { graphistryJS } from '@graphistry/client-api';
const g = graphistryJS(elt);
const G = require('@graphistry/client-api');
const g = G.graphistryJS(elt);

Dual usage modes

The library exposes two calling conventions to choose from.

RxJS orchestrations

const G = GraphistryModule;
document.addEventListener("DOMContentLoaded", function () {

    var g = G.graphistryJS(document.getElementById('viz'));
    var sub = g.pipe(
            G.tap(() => console.log('GraphistryJS ready instance as window.g')),
            G.delay(5000),
            G.addFilter('point:degree > 1'),
            G.updateSetting('background', '#FF0000')
        )
        .subscribe(
            function () {},
            function (err) { console.error('exn on setup', err); },
            function () { console.log('finished setup'); });

    //Optional: sub.unsubscribe() to cancel

});

Async commands

const G = GraphistryModule;
document.addEventListener("DOMContentLoaded", function () {

    var g = G.graphistryJS(document.getElementById('viz'));
    g.pipe(
        G.tap(() => {

            //non-rxjs on ready g
            console.log('GraphistryJS ready instance as window.g');
            setTimeout(
                () => {
                    g.addFilter();
                    g.updateSetting('background', '#FF0000');
                },
                5000);

        }))
        .subscribe();

});

Uploads

You can also use the library to configure & upload visualization data, and get back dataset IDs to embed as a live visualization:

import { Client, Dataset, File, EdgeFile, NodeFile } from '@graphistry/client-api';

//defaults: 'https', 'hub.graphistry.com', 'https://hub.graphistry.com'
const client = new Client('my_username', 'my_password');

//columnar data is fastest; column per attribute; reuse across datasets
const edgesFile = new EdgeFile({'s': ['a1', 'b2'], 'd': ['b2', 'c3']});
const nodesFile = new NodeFile({'n': ['a1', 'b2', 'c3'], 'a1': ['x', 'y', 'z']});

const dataset = new Dataset({
    node_encodings: { bindings: { node: 'n' } },
    edge_encodings: { bindings: { source: 's', destination: 'd' } },
    metadata: {},
    name: 'testdata',
}, edgesFile, nodesFile);

await dataset.upload();
console.info(`View at ${dataset.datasetID} at ${dataset.datasetURL}`);

See additional examples in the @graphistry/node-api docs or API references here

5.1.1

1 month ago

5.1.0

2 months ago

5.0.2

3 months ago

5.0.1

3 months ago

5.0.0

3 months ago

4.6.0-alpha.1

1 year ago

4.6.0-alpha.2

1 year ago

4.4.1

1 year ago

4.4.0

1 year ago

4.6.1

1 year ago

4.6.0

1 year ago

4.6.6

1 year ago

4.5.0-alpha.5

1 year ago

4.5.0-alpha.4

1 year ago

4.5.0-alpha.3

1 year ago

4.6.2

1 year ago

4.5.0-alpha.2

1 year ago

4.6.5

1 year ago

4.5.0

1 year ago

4.3.0-alpha.0

1 year ago

4.3.0-alpha.1

1 year ago

4.3.0-alpha.2

1 year ago

4.3.0

1 year ago

4.2.0

2 years ago

4.1.8

2 years ago

4.1.4-alpha.0

2 years ago

4.1.6

2 years ago

4.1.8-beta0

2 years ago

4.1.8-beta1

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.5

2 years ago

4.0.3-alpha

2 years ago

4.1.1-alpha

2 years ago

4.0.4

2 years ago

4.0.6

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.1.0-alpha

2 years ago

4.0.3-alpha.2

2 years ago

4.0.3-alpha.4

2 years ago

4.0.1-alpha

2 years ago

4.1.1-alpha3

2 years ago

4.1.0

2 years ago

4.1.2

2 years ago

4.1.1-alpha2

2 years ago

4.0.0-beta.5

2 years ago

4.0.0-beta.4

2 years ago

4.0.0-beta.3

2 years ago

4.0.0-beta.2

2 years ago

4.0.0-beta.1

2 years ago

4.0.1

2 years ago

4.0.0-alpha.7

2 years ago

4.0.0-alpha.5

2 years ago

4.0.0-alpha.6

2 years ago

4.0.0-alpha.3

2 years ago

4.0.0-alpha.4

2 years ago

4.0.0-alpha.1

2 years ago

4.0.0-alpha.2

2 years ago

4.0.0-alpha.0

2 years ago

3.7.6

3 years ago

3.7.1

5 years ago

3.7.0

5 years ago

3.6.0

5 years ago

3.5.0

6 years ago

3.4.4

6 years ago

3.4.2

6 years ago

3.4.0

6 years ago

2.15.3

6 years ago

2.15.2

7 years ago

2.15.1

7 years ago

2.15.0

7 years ago

2.14.0

7 years ago

2.13.7

7 years ago

2.13.6

7 years ago

2.13.0

7 years ago

2.12.6

7 years ago

2.12.4

7 years ago

2.12.3

7 years ago

2.12.2

7 years ago

2.12.1

7 years ago

2.12.0

7 years ago