cytoscape-node-editing

A Cytoscape.js extension to provide grapples to resize nodes

https://github.com/ivis-at-bilkent/cytoscape.js-node-editing

Science Score: 75.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    3 of 15 committers (20.0%) from academic institutions
  • Institutional organization owner
    Organization ivis-at-bilkent has institutional domain (www.cs.bilkent.edu.tr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

cytoscapejs cytoscapejs-extension diagramming editor graph-drawing network-visualization

Keywords from Contributors

complexity-management
Last synced: 6 months ago · JSON representation ·

Repository

A Cytoscape.js extension to provide grapples to resize nodes

Basic Info
  • Host: GitHub
  • Owner: iVis-at-Bilkent
  • License: mit
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 1.89 MB
Statistics
  • Stars: 26
  • Watchers: 12
  • Forks: 14
  • Open Issues: 6
  • Releases: 16
Topics
cytoscapejs cytoscapejs-extension diagramming editor graph-drawing network-visualization
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

cytoscape-node-editing

Description

A Cytoscape.js extension to provide certain node editing functionality as follows: - grapples to resize nodes, - a visual cue to resize node to its label, and - ability to move selected nodes with arrow keys (accelerator keys Alt and Shift result in slower and faster moves, respectively), distributed under The MIT License.

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

Here are demos: simple and undoable, respectively:

Default Options

```js cy.nodeEditing({ padding: 5, // spacing between node and grapples/rectangle undoable: true, // and if cy.undoRedo exists

            grappleSize: 8, // size of square dots
            grappleColor: "green", // color of grapples
            grappleStrokeColor: "black", // stroke color of the grapples
            grappleStrokeWidth: 0, // stroke width of the grapples
            grappleCornerRadius: 0, // corner radius of the grapples
            inactiveGrappleStroke: "inside 1px blue",               
            boundingRectangleLineDash: [4, 8], // line dash of bounding rectangle
            boundingRectangleLineColor: "red",
            boundingRectangleLineWidth: 1.5,
            zIndex: 999,

            minWidth: function (node) {
                var data = node.data("resizeMinWidth");
                return data ? data : 15;
            }, // a function returns min width of node
            minHeight: function (node) {
                var data = node.data("resizeMinHeight");
                return data ? data : 15;
            }, // a function returns min height of node

            // Getters for some style properties the defaults returns ele.css('property-name')
            // you are encouraged to override these getters
            getCompoundMinWidth: function(node) { 
              return node.css('min-width'); 
            },
            getCompoundMinHeight: function(node) { 
              return node.css('min-height'); 
            },
            getCompoundMinWidthBiasRight: function(node) {
              return node.css('min-width-bias-right');
            },
            getCompoundMinWidthBiasLeft: function(node) { 
              return node.css('min-width-bias-left');
            },
            getCompoundMinHeightBiasTop: function(node) {
              return node.css('min-height-bias-top');
            },
            getCompoundMinHeightBiasBottom: function(node) { 
              return node.css('min-height-bias-bottom');
            },

            // These optional functions will be executed to set the width/height of a node in this extension
            // Using node.css() is not a recommended way (http://js.cytoscape.org/#eles.style) to do this. Therefore,
            // overriding these defaults so that a data field or something like that will be used to set node dimentions
            // instead of directly calling node.css() is highly recommended (Of course this will require a proper 
            // setting in the stylesheet).
            setWidth: function(node, width) { 
                node.css('width', width);
            },
            setHeight: function(node, height) {
                node.css('height', height);
            },

            isFixedAspectRatioResizeMode: function (node) { return node.is(".fixedAspectRatioResizeMode") },// with only 4 active grapples (at corners)
            isNoResizeMode: function (node) { return node.is(".noResizeMode, :parent") }, // no active grapples
            isNoControlsMode: function (node) { return node.is(".noControlsMode") }, // no controls - do not draw grapples

            cursors: { // See http://www.w3schools.com/cssref/tryit.asp?filename=trycss_cursor
                // May take any "cursor" css property
                default: "default", // to be set after resizing finished or mouseleave
                inactive: "not-allowed",
                nw: "nw-resize",
                n: "n-resize",
                ne: "ne-resize",
                e: "e-resize",
                se: "se-resize",
                s: "s-resize",
                sw: "sw-resize",
                w: "w-resize"
            },

            // enable resize content cue according to the node
            resizeToContentCueEnabled: function (node) {
              return true;
            },
            // handle resize to content with given function
            // default function resizes node according to the label
            resizeToContentFunction: undefined,
            // select position of the resize to content cue
            // options: 'top-left', 'top-right', 'bottom-left', 'bottom-right'
            resizeToContentCuePosition: 'bottom-right',
            // relative path of the resize to content cue image
            resizeToContentCueImage: '/node_modules/cytoscape-node-editing/resizeCue.svg',
            enableMovementWithArrowKeys: true,
            autoRemoveResizeToContentCue: false,
         });

```

API

var api = cy.nodeEditing('get') To get the extension instance after initialization.

api.refreshGrapples() Refresh rendered node grapples if any. It is an expensive operation and is supposed to be called in rare cases (When it is really needed).

api.removeGrapples() Remove grapples while node is selected. This is useful when a node is selected but no need to show grapples.

Dependencies

  • Cytoscape.js ^3.2.0
  • jquery ^1.7.0 || ^2.0.0 || ^3.0.0
  • konva ^7.0.3
  • cytoscape-undo-redo ^1.0.10 (optional)

Usage instructions

Download the library: * via npm: npm install cytoscape-node-editing, * via bower: bower install cytoscape-node-editing, or * via direct download in the repository (probably from a tag).

require() the library as appropriate for your project:

CommonJS: ```js var cytoscape = require('cytoscape'); var nodeEditing = require('cytoscape-node-editing'); var konva = require('konva');

nodeEditing( cytoscape, jQuery, konva ); // register extension ```

AMD: js require(['cytoscape', 'cytoscape-node-editing', 'jquery', 'konva'], function( cytoscape, nodeEditing, jQuery, konva ){ nodeEditing( cytoscape, jQuery, konva ); // register extension });

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

Emitted Events

cy.on("nodeediting.resizestart", function(e, type, node){ })

cy.on("nodeediting.resizeend", function(e, type, node){ })

cy.on("nodeediting.resizedrag", function(e, type, node){ })

cy.on("nodeediting.resizetocontent", function(e, node){ })

type param can be topleft, topcenter, topright, centerright, bottomright, bottomcenter, bottomleft, centerleft

node param corresponds to currently resizing node.

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-node-editing https://github.com/iVis-at-Bilkent/cytoscape.js-node-editing.git

Team

Alumni

Owner

  • Name: i-Vis at Bilkent
  • Login: iVis-at-Bilkent
  • Kind: organization

i-Vis Research Lab at Bilkent University

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Dogrusoz"
  given-names: "Ugur"
  orcid: "https://orcid.org/0000-0002-7153-0784"
- family-names: "Karacelik"
  given-names: "Alper"
  orcid: "https://orcid.org/0000-0000-0000-0000"
- family-names: "Safarli"
  given-names: "Ilkin"
- family-names: "Balci"
  given-names: "Hasan"
  orcid: "https://orcid.org/0000-0001-8319-7758"
- family-names: "Dervishi"
  given-names: "Leonard"
- family-names: "Siper"
  given-names: "Metin Can" 
title: "cytoscape-node-editing"
version: 4.1.0
date-released: 2021-06-16
url: "https://github.com/iVis-at-Bilkent/cytoscape.js-node-editing"
preferred-citation:
  type: article
  authors:
  - family-names: "Dogrusoz"
    given-names: "Ugur"
    orcid: "https://orcid.org/0000-0002-7153-0784"
  - family-names: "Karacelik"
    given-names: "Alper"
    orcid: "https://orcid.org/0000-0000-0000-0000"
  - family-names: "Safarli"
    given-names: "Ilkin"
  - family-names: "Balci"
    given-names: "Hasan"
    orcid: "https://orcid.org/0000-0001-8319-7758"
  - family-names: "Dervishi"
    given-names: "Leonard"
  - family-names: "Siper"
    given-names: "Metin Can"
  doi: "10.1371/journal.pone.0197238"
  journal: "PLOS ONE"
  month: 5
  start: 1 # First page number
  end: 18 # Last page number
  title: "Efficient methods and readily customizable libraries for managing complexity of large networks"
  issue: 5
  volume: 13
  year: 2018

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 181
  • Total Committers: 15
  • Avg Commits per committer: 12.067
  • Development Distribution Score (DDS): 0.818
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
metincansiper m****r@g****m 33
Salih Altun m****n@g****m 25
mrsfy m****y@o****m 23
Hasan Balcı b****9@g****m 21
ugurdogrusoz u****z@g****m 20
Ahmet Çandıroğlu a****u@g****m 18
Ludovic Roy l****y@e****g 14
kinimesi k****i@u****m 9
leonarddrv l****i@b****r 7
Salih Altun s****n@u****r 3
Nasim Saleh n****h@g****m 3
kinimesi i****i@s****r 2
FirstBug m****e@g****m 1
İstemi Bahçeci i****i@g****m 1
Taehyun Kim k****2@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 40
  • Total pull requests: 15
  • Average time to close issues: 4 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 24
  • Total pull request authors: 11
  • Average comments per issue: 2.7
  • Average comments per pull request: 1.53
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ugurdogrusoz (8)
  • metincansiper (4)
  • kinimesi (3)
  • PermanAtayev (2)
  • Hoogkamer (2)
  • msalihaltun (2)
  • mafar (2)
  • TheDrEmil (1)
  • marfyl (1)
  • micholenko (1)
  • vinay-nadig-0042 (1)
  • vandaothu (1)
  • hasanbalci (1)
  • leonarddrv (1)
  • tntmarket (1)
Pull Request Authors
  • hasanbalci (4)
  • mafar (2)
  • Adam-Shea (2)
  • kimxogus (1)
  • absharma9796 (1)
  • Hoogkamer (1)
  • msalihaltun (1)
  • royludo (1)
  • tntmarket (1)
  • metincansiper (1)
  • marfyl (1)
Top Labels
Issue Labels
bug (4) enhancement (3) Critical (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 1,173 last-month
  • Total dependent packages: 2
  • Total dependent repositories: 15
  • Total versions: 3
  • Total maintainers: 1
npmjs.org: cytoscape-node-editing

cytoscape-node-editing ================================================================================

  • Versions: 3
  • Dependent Packages: 2
  • Dependent Repositories: 15
  • Downloads: 1,173 Last month
Rankings
Dependent repos count: 3.1%
Downloads: 3.7%
Average: 5.8%
Forks count: 5.9%
Stargazers count: 7.5%
Dependent packages count: 8.8%
Maintainers (1)
Last synced: 7 months ago

Dependencies

package-lock.json npm
  • 244 dependencies
package.json npm
  • babel-core ^6.26.3 development
  • babel-loader ^7.1.5 development
  • babel-preset-env ^1.7.0 development
  • camelcase ^6.0.0 development
  • cross-env ^7.0.2 development
  • webpack ^5.36.1 development
  • webpack-cli ^4.6.0 development
bower.json bower