All Projects → cytoscape → cytoscape.js-panzoom

cytoscape / cytoscape.js-panzoom

Licence: MIT license
Panzoom extension for Cytoscape.js

Programming Languages

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

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

cytoscape.js-context-menus
A Cytoscape.js extension to provide context menu around elements and core instance
Stars: ✭ 63 (+1.61%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-graphml
A Cytoscape.js extension to import from and export to GraphML format
Stars: ✭ 26 (-58.06%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-spread
The speedy Spread physics simulation layout for Cytoscape.js
Stars: ✭ 20 (-67.74%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-bubblesets
Cytoscape.js Bubblesets plugin
Stars: ✭ 18 (-70.97%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
cytoscape.js-qtip
A Cytoscape.js extension that wraps the QTip jQuery library
Stars: ✭ 39 (-37.1%)
Mutual labels:  cytoscapejs, cytoscapejs-extension
Cytoscape.js
Graph theory (network) library for visualisation and analysis
Stars: ✭ 8,107 (+12975.81%)
Mutual labels:  cytoscapejs
CoNekT
CoNekT (short for Co-expression Network Toolkit) is a platform to browse co-expression data and enable cross-species comparisons.
Stars: ✭ 17 (-72.58%)
Mutual labels:  cytoscapejs
cytosnap
A Node.js package that renders images of Cytoscape.js graphs on the server using Puppeteer
Stars: ✭ 48 (-22.58%)
Mutual labels:  cytoscapejs
react-cytoscape
react component for cytoscape
Stars: ✭ 31 (-50%)
Mutual labels:  cytoscapejs

cytoscape-panzoom

DOI

Preview

Description

This extension creates a widget that lets the user pan and zoom about a Cytoscape.js graph. This complements the built-in gesture support for panning and zooming in Cytoscape.js by giving less savvy users a more traditional UI -- similar to controls on map webapps.

Dependencies

  • jQuery ^1.4 || ^2.0 || ^3.0
  • Cytoscape.js ^2.0.0 || ^3.0.0
  • Font Awesome 4 (for automatic icons), or you can specify your own class names for icons

Usage instructions

Download the library:

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

require() the library as appropriate for your project:

CommonJS:

var cytoscape = require('cytoscape');
var panzoom = require('cytoscape-panzoom');

panzoom( cytoscape ); // register extension

// you can pass a custom version of jquery outside of the path
// panzoom( cytoscape, $ ); // you shouldn't do this in a modern project...

AMD:

require(['cytoscape', 'jquery', 'cytoscape-panzoom'], function( cytoscape, $, panzoom ){
  panzoom( cytoscape, $ ); // register extension
});

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

You should either include cytoscape.js-panzoom.css (see style in package.json) or a similar custom stylesheet in your project.

API

// the default values of each option are outlined below:
var defaults = {
  zoomFactor: 0.05, // zoom factor per zoom tick
  zoomDelay: 45, // how many ms between zoom ticks
  minZoom: 0.1, // min zoom level
  maxZoom: 10, // max zoom level
  fitPadding: 50, // padding when fitting
  panSpeed: 10, // how many ms in between pan ticks
  panDistance: 10, // max pan distance per tick
  panDragAreaSize: 75, // the length of the pan drag box in which the vector for panning is calculated (bigger = finer control of pan speed and direction)
  panMinPercentSpeed: 0.25, // the slowest speed we can pan by (as a percent of panSpeed)
  panInactiveArea: 8, // radius of inactive area in pan drag box
  panIndicatorMinOpacity: 0.5, // min opacity of pan indicator (the draggable nib); scales from this to 1.0
  zoomOnly: false, // a minimal version of the ui only with zooming (useful on systems with bad mousewheel resolution)
  fitSelector: undefined, // selector of elements to fit
  animateOnFit: function(){ // whether to animate on fit
    return false;
  },
  fitAnimationDuration: 1000, // duration of animation on fit

  // icon class names
  sliderHandleIcon: 'fa fa-minus',
  zoomInIcon: 'fa fa-plus',
  zoomOutIcon: 'fa fa-minus',
  resetIcon: 'fa fa-expand'
};

// add the panzoom control
cy.panzoom( defaults );

// destroy the panzoom control
cy.panzoom('destroy');

Publishing instructions

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

  1. Set the version number environment variable: export VERSION=1.2.3
  2. Publish: gulp publish
  3. If publishing to bower for the first time, you'll need to run bower register cytoscape-panzoom https://github.com/cytoscape/cytoscape.js-panzoom.git
  4. Make a release on GitHub to automatically register a new Zenodo DOI
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].