All Projects → iVis-at-Bilkent → cytoscape.js-context-menus

iVis-at-Bilkent / cytoscape.js-context-menus

Licence: MIT License
A Cytoscape.js extension to provide context menu around elements and core instance

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to cytoscape.js-context-menus

cytoscape.js-graphml
A Cytoscape.js extension to import from and export to GraphML format
Stars: ✭ 26 (-58.73%)
Mutual labels:  network-visualization, graph-drawing, cytoscapejs, cytoscapejs-extension
cytoscape.js-bubblesets
Cytoscape.js Bubblesets plugin
Stars: ✭ 18 (-71.43%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-panzoom
Panzoom extension for Cytoscape.js
Stars: ✭ 62 (-1.59%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-spread
The speedy Spread physics simulation layout for Cytoscape.js
Stars: ✭ 20 (-68.25%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-qtip
A Cytoscape.js extension that wraps the QTip jQuery library
Stars: ✭ 39 (-38.1%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
VOSviewer-Online
VOSviewer Online is a tool for network visualization. It is a web-based version of VOSviewer, a popular tool for constructing and visualizing bibliometric networks.
Stars: ✭ 44 (-30.16%)
Mutual labels:  network-visualization
AOS4ReID
Adversarially Occluded Samples for Person Re-identification, CVPR 2018
Stars: ✭ 32 (-49.21%)
Mutual labels:  network-visualization
netplot
Beautiful graph drawing
Stars: ✭ 47 (-25.4%)
Mutual labels:  network-visualization
newt
A web application to visualize and edit pathway models
Stars: ✭ 46 (-26.98%)
Mutual labels:  network-visualization
pep map site
🐍 Web page that visualizes the reference relation between PEPs (Python Enhancement Proposals).
Stars: ✭ 17 (-73.02%)
Mutual labels:  network-visualization
taskbar-monitor
monitoring tool with graphs (CPU, memory, disk and network) for Windows taskbar.
Stars: ✭ 121 (+92.06%)
Mutual labels:  network-visualization
chise.js
A web application to visualize and edit the pathway models represented by SBGN Process Description Notation
Stars: ✭ 15 (-76.19%)
Mutual labels:  network-visualization
National-Petition
청와대 국민청원 분석으로 국민의 생각 알아보기 📈🔬
Stars: ✭ 45 (-28.57%)
Mutual labels:  network-visualization
Junet.jl
Julia package for network research
Stars: ✭ 37 (-41.27%)
Mutual labels:  network-visualization
local-government-desktop-addins
A series of ArcGIS Desktop Add-ins used in the ArcGIS for Local Government editing maps.
Stars: ✭ 58 (-7.94%)
Mutual labels:  network-visualization
obvz
org-brain visualization via PyQt
Stars: ✭ 64 (+1.59%)
Mutual labels:  network-visualization
giraphe
Discover and visualize layer-2 and layer-3 network topology
Stars: ✭ 15 (-76.19%)
Mutual labels:  network-visualization
jungrapht-visualization
visualization and sample code from Java Universal Network Graph ported to use JGraphT models and algorithms
Stars: ✭ 37 (-41.27%)
Mutual labels:  network-visualization
CoNekT
CoNekT (short for Co-expression Network Toolkit) is a platform to browse co-expression data and enable cross-species comparisons.
Stars: ✭ 17 (-73.02%)
Mutual labels:  cytoscapejs
FlowSharpWeb
A web-based implementation of FlowSharp
Stars: ✭ 31 (-50.79%)
Mutual labels:  diagramming

cytoscape-context-menus

Description

A Cytoscape.js extension to provide context menu around elements and core instance distributed under The MIT License.

Image of extension

Please cite the following paper when using this extension:

U. Dogrusoz , A. Karacelik, I. Safarli, H. Balci, L. Dervishi, and M.C. Siper, "Efficient methods and readily customizable libraries for managing complexity of large networks", PLoS ONE, 13(5): e0197238, 2018.

Demo

Click here (simple) or here (customized) or here (with different menu items) for demos

Dependencies

  • Cytoscape.js ^2.7.0 || ^3.0.0

Usage instructions

Download the library:

  • via npm: npm install cytoscape-context-menus,
  • via bower: bower install cytoscape-context-menus, or
  • via direct download in the repository (probably from a tag).

Import the library as appropriate for your project:

ES import:

Note: es import doesn't work for plain javascript applications because webpack doesn't support es module output at the moment.

import cytoscape from 'cytoscape';
import contextMenus from 'cytoscape-context-menus';

// register extension
cytoscape.use(contextMenus);

// import CSS as well
import 'cytoscape-context-menus/cytoscape-context-menus.css';

CommonJS:

var cytoscape = require('cytoscape');
var contextMenus = require('cytoscape-context-menus');

contextMenus(cytoscape); // register extension

AMD:

require(['cytoscape', 'cytoscape-context-menus'], function(cytoscape, contextMenus) {
  contextMenus(cytoscape); // register extension
});

Plain HTML/JS has the extension registered for you automatically, because no require() is needed.

Default Options

var options = {
    // Customize event to bring up the context menu
    // Possible options https://js.cytoscape.org/#events/user-input-device-events
    evtType: 'cxttap',
    // List of initial menu items
    // A menu item must have either onClickFunction or submenu or both
    menuItems: [/*
      {
        id: 'remove', // ID of menu item
        content: 'remove', // Display content of menu item
        tooltipText: 'remove', // Tooltip text for menu item
        image: {src : "remove.svg", width : 12, height : 12, x : 6, y : 4}, // menu icon
        // Filters the elements to have this menu item on cxttap
        // If the selector is not truthy no elements will have this menu item on cxttap
        selector: 'node, edge', 
        onClickFunction: function () { // The function to be executed on click
          console.log('remove element');
        },
        disabled: false, // Whether the item will be created as disabled
        show: false, // Whether the item will be shown or not
        hasTrailingDivider: true, // Whether the item will have a trailing divider
        coreAsWell: false // Whether core instance have this item on cxttap
        submenu: [] // Shows the listed menuItems as a submenu for this item. An item must have either submenu or onClickFunction or both.
      },
      {
        id: 'hide',
        content: 'hide',
        tooltipText: 'hide',
        selector: 'node, edge',
        onClickFunction: function () {
          console.log('hide element');
        },
        disabled: true
      },
      {
        id: 'add-node',
        content: 'add node',
        tooltipText: 'add node',
        image: {src : "add.svg", width : 12, height : 12, x : 6, y : 4},
        selector: 'node',
        coreAsWell: true,
        onClickFunction: function () {
          console.log('add node');
        }
      }*/
    ],
    // css classes that menu items will have
    menuItemClasses: [
      // add class names to this list
    ],
    // css classes that context menu will have
    contextMenuClasses: [
      // add class names to this list
    ],
    // Indicates that the menu item has a submenu. If not provided default one will be used
    submenuIndicator: { src: 'assets/submenu-indicator-default.svg', width: 12, height: 12 }
};

Note: selector and coreAsWell options are ignored for the items that are inside a submenu. Their visiblity depends on their root parent's visibility.

API

Instance API

var instance = cy.contextMenus(options);

instance.isActive()

  • Returns whether the extension is active.

instance.appendMenuItem(item, parentID = undefined)

  • Appends given menu item to the menu items list.
  • If parentID is specified, the item is inserted to the submenu of the item with parentID.
  • If the parent has no submenu then it will automatically be created.
  • If not specified item will be inserted to the root of the contextmenu

instance.appendMenuItems(items, parentID = undefined)

  • Same with above but takes an array of items

instance.removeMenuItem(itemID)

  • Removes the menu item with given ID and its submenu along with

instance.setTrailingDivider(itemID, status)

  • Sets whether the menuItem with given ID will have a following divider

instance.insertBeforeMenuItem(item, existingItemID)

  • Inserts given item before the existingitem

instance.moveToSubmenu(itemID, options = null)

  • Moves the item with given ID to the submenu of the parent with the given ID or to root with the specified options
  • If options is a string, then it is the id of the parent
  • If options is a { selector?: string, coreAsWell?: boolean }, then old properties are overwritten by them and the menu item is moved to the root. If it doesn't have either properties item is not moved.
  • If options is null or not provided, then it is just moved to the root

instance.moveBeforeOtherMenuItem(itemID, existingItemID)

  • Inserts the item before the existingItem and moves it to the submenu that contains the existingItem

instance.disableMenuItem(itemID)

  • Disables the menu item with given ID.

instance.enableMenuItem(itemID)

  • Enables the menu item with given ID.

instance.showMenuItem(itemID)

  • Shows the menu item with given ID.

instance.hideMenuItem(itemID)

  • Hides the menu item with given ID.

instance.destroy()

  • Destroys the extension instance

Other API

cy.contextMenus('get')

  • Returns the existing instance to the extension

Build targets

  • npm run build : Build ./src/** into cytoscape-edge-editing.js in production environment and minimize the file.
  • npm run build:dev : Build ./src/** into cytoscape-edge-editing.js in development environment without minimizing the file.

Publishing instructions

This project is set up to automatically be published to npm and bower. To publish:

  1. Build the extension : npm run build
  2. Commit the build : git commit -am "Build for release"
  3. Bump the version number and tag: npm version major|minor|patch
  4. Push to origin: git push && git push --tags
  5. Publish to npm: npm publish .
  6. If publishing to bower for the first time, you'll need to run bower register cytoscape-context-menus https://github.com/iVis-at-Bilkent/cytoscape.js-context-menus.git

Team

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].