Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

buche-cytoscape

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buche-cytoscape

Cytoscape channel and element for Buche.

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

buche-cytoscape

Buche plugin for the cytoscape graph library.

Provides the cytoscape-graph component and the cytoscape channel type.

Use

First you must output the following buche command:

{"command":"require","path":"/","pluginName":"cytoscape"}

Buche will prompt you to install the plugin if it is not available, although you can install it manually with buche --install cytoscape.

cytoscape channel

The cytoscape channel lets you define a graph and add nodes and edges in real time.

Create the channel

{"command":"open","path":"/graph","type":"cytoscape","options":{"style":"<style or path>","layout":{"name":"cola"}, ...}}

For the possible options, see: http://js.cytoscape.org/#core/initialisation

The style can be given as a string, as a path to a css file, or as a JSON structure as described in cytoscape's documentation. See: http://js.cytoscape.org/#style

Then you can use the element command to add nodes and edges. There is a simple and basic way to do it, and a more full-featured one.

Add a node

This create a node with id A:

{"command":"element","path":"/graph","id":"A"}

Add an edge

This creates an edge between nodes A and B, but note that both must exist before the edge can be defined.

{"command":"element","path":"/graph","source":"A","target":"B"}

You can give an options object with more customization. Available options: http://js.cytoscape.org/#notation/elements-json

{"command":"element","path":"/graph","options": {"data": {"source":"A","target":"B"},"classes":"abc"}}

cytoscape-graph component

Defines a self-contained graph in a single tag.

Children of the cytoscape-graph tag must be:

<cytoscape-graph>
    <style>
        node {
            background-color: blue;
            content: data(id);
        }
        edge {
            line-color: green;
            target-arrow-color: green;
            target-arrow-shape: triangle;
            curve-style: bezier;
        }
    </style>
    <config>
    {
        "layout": {"name": "cose"}
    }
    </config>
    <element>{"data": {"id": "A"}}</element>
    <element>{"data": {"id": "B"}}</element>
    <element>{"data": {"id": "C"}}</element>
    <element>{"data": {"id": "D"}}</element>
    <element>{"data": {"id": "E"}}</element>
    <element>{"data": {"source": "A", "target": "B"}}</element>
    <element>{"data": {"source": "B", "target": "C"}}</element>
    <element>{"data": {"source": "C", "target": "A"}}</element>
    <element>{"data": {"source": "A", "target": "D"}}</element>
    <element>{"data": {"source": "D", "target": "E"}}</element>
</cytoscape-graph>

Keywords

FAQs

Package last updated on 17 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc