Giter VIP home page Giter VIP logo

vis-network's Introduction

vis-network

example chart

Network is a visualization to display networks and networks consisting of nodes and edges. The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more. The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.

Badges

semantic-release Renovate npm

dependencies Status devDependencies Status peerDependencies Status

GitHub contributors Backers on Open Collective Sponsors on Open Collective

Install

Install via npm:

$ npm install vis-network

Example

A basic example on loading a Network is shown below. More examples can be found in the examples directory of the project.

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Network</title>
    <script
      type="text/javascript"
      src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
    ></script>
    <style type="text/css">
      #mynetwork {
        width: 600px;
        height: 400px;
        border: 1px solid lightgray;
      }
    </style>
  </head>
  <body>
    <div id="mynetwork"></div>
    <script type="text/javascript">
      // create an array with nodes
      var nodes = new vis.DataSet([
        { id: 1, label: "Node 1" },
        { id: 2, label: "Node 2" },
        { id: 3, label: "Node 3" },
        { id: 4, label: "Node 4" },
        { id: 5, label: "Node 5" },
      ]);

      // create an array with edges
      var edges = new vis.DataSet([
        { from: 1, to: 3 },
        { from: 1, to: 2 },
        { from: 2, to: 4 },
        { from: 2, to: 5 },
        { from: 3, to: 3 },
      ]);

      // create a network
      var container = document.getElementById("mynetwork");
      var data = {
        nodes: nodes,
        edges: edges,
      };
      var options = {};
      var network = new vis.Network(container, data, options);
    </script>
  </body>
</html>

Build

To build the library from source, clone the project from github

$ git clone git://github.com/visjs/vis-network.git

The source code uses the module style of node (require and module.exports) to organize dependencies. To install all dependencies and build the library, run npm install in the root of the project.

$ cd vis-network
$ npm install

Then, the project can be build running:

$ npm run build

Test

To test the library, install the project dependencies once:

$ npm install

Then run the tests:

$ npm run test

Contribute

Contributions to the vis.js library are very welcome! We can't do this alone!

Backers

Thank you to all our backers! ๐Ÿ™

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

License

Copyright (C) 2010-2018 Almende B.V. and Contributors Copyright (c) 2018-2021 Vis.js contributors

Vis.js is dual licensed under both

and

Vis.js may be distributed under either license.

vis-network's People

Contributors

alexdm0 avatar bradh avatar brendon1982 avatar capitanmorgan avatar cdjackson avatar ckane avatar dependabot[bot] avatar dturkenk avatar dude9177 avatar eymiha avatar fabriziofortino avatar felixhayashi avatar gillingham avatar greenkeeper[bot] avatar josdejong avatar justinharrell avatar kannonboy avatar lewisjb avatar ludost avatar macleodbroad-wf avatar mdouailin avatar mojoaxel avatar piratuks avatar renovate[bot] avatar stexxen avatar thomaash avatar tyler-maclachlan avatar vukk avatar wimrijnders avatar yotamberk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vis-network's Issues

WebGL Renderer

Hi guys,

Firstly thanks for merging my changes from visjs-community/visjs-network.

Seeing as the 'official' project is starting back up perhaps it is time to get rid of the canvas renderer and use something like PixiJS (they have a canvas fallback) to increase performance especially on super large graphs.

I'd be happy to contribute to doing this, I just need someone a bit more experienced with the library to give me some pointers on where to go about changing things.

Network - EdgeEdge/EditWithoutDrag return complex objects

The edgeData that is passed to the EditEdge/EditWithoutDrag function is a complex object, rather than a standalone edge (perhaps there's a reason for this, documentation is lacking...) and the callback then fails with "Cannot read property 'connected' of undefined" at e.value (vis-network.esm.min.js:13426).

I suspect this has to do with the fact that edgeData.from is an object (the "from" edge object) rather than an ID. The same applies to edgeData.to. If I do edgeData.from = edgeData.from.id before the callback then the callback succeeds and the network graph is updated correctly.

Happy to do a recreation if you really need it, but I think this explains the problem pretty clearly.

Feature-Request: support image padding for the image shape

I'd like to add a feature to set a padding around the image located inside the image shape. It would help to show the shape color for any images as for now to achieve this you need to use PNG with transparent borders inside the image to mimic such behavior.
I have already some code and example here in my fork.

It allows to set the individual image padding at Node level:
imagePadding: { left: 2, top: 10, right: 8, bottom: 20},
or
imagePadding: 10
It also takes care of useImageSize, if useImageSize = true then the resulting shape size calculated as image dimensions + image padding. Else image dimensions reduced by image padding to save the shape dimensions set by size at network or node level options.

vis-network_imagePadding

Can not render in IE 11.

Hey,
I had an issue when using Visjs on IE 11. UI was not rendered and the error was shown in the picture below

Capture1

Browser: IE 11.
Version: 11.615.17763.0

Network Canvas keeps growing vertically on window resize

Chrome 76.0.3809.100 on Ubuntu 19.04

I'm using a table. Don't judge, please. I'm not looking for advice like "Don't use tables, then." If you really don't care (because nobody should be using tables) then fine. (I get the exact same behaviour if I use divs with layout:table-*)

The problem seems to be related to position:absolute; in the table's style.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

  <script type="text/javascript" src="https://visjs.github.io/vis-network/dist/vis-network.min.js"></script>
  <link href="https://visjs.github.io/vis-network/dist/vis-network.min.css" rel="stylesheet" type="text/css" />

</head>
<body>
  <table style="width:100%; height:100%; position:absolute; vertical-align:top;">
    <tr>
      <td style="width:50%; height:100%;">
        <div style="width:100%;height:100%; overflow:hidden;" id="mynetwork"></div>
      </td>
      <td style="width:50%; height:100%;">
      </td>
    </tr>
  </table>
  <script type="text/javascript">
  // create an array with nodes
  var nodes = new vis.DataSet([
    {id: 1, label: 'Node 1'},
    {id: 2, label: 'Node 2'},
    {id: 3, label: 'Node 3'},
    {id: 4, label: 'Node 4'},
    {id: 5, label: 'Node 5'}
  ]);

  // create an array with edges
  var edges = new vis.DataSet([
    {from: 1, to: 3},
    {from: 1, to: 2},
    {from: 2, to: 4},
    {from: 2, to: 5},
    {from: 3, to: 3}
  ]);

  // create a network
  var container = document.getElementById('mynetwork');
  var data = {
    nodes: nodes,
    edges: edges
  };
  var options = { autoResize:true, width:"100%",height:"100%" };
  var network = new vis.Network(container, data, options);
  </script>
</body>
</html>

bad rendering and network.body.view.translation is {x:NaN, y:NaN}

Hi

There is a hard-to-reproduce bug with vis network 4.21.0 : sometimes, the networks is not rendered properly (only edges), and it is related to network.body.view.translation being {x:NaN, y:NaN}.

I'm getting the issue on all kind of browser and on different computers, especially the slower one. Maybe the browser is trying to render before the network has been initialized ?

I've found I can reset the view translation to x:0,y:0, then redraw().

Is this bug solved in the 5.0 ?

Regards

An in-range update of @typescript-eslint/eslint-plugin is breaking the build ๐Ÿšจ

The devDependency @typescript-eslint/eslint-plugin was updated from 2.0.0 to 2.1.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/eslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โœ… ci/circleci: prepare: Your tests passed on CircleCI! (Details).
  • โŒ ci/circleci: build: CircleCI is running your tests (Details).
  • โŒ ci/circleci: lint_ts: Your tests failed on CircleCI (Details).
  • โœ… ci/circleci: test: Your tests passed on CircleCI! (Details).

Release Notes for v2.1.0

2.1.0 (2019-09-02)

Bug Fixes

  • eslint-plugin: [member-naming] should match constructor args (#771) (b006667)
  • eslint-plugin: [no-inferrable-types] ignore optional props (#918) (a4e625f)
  • eslint-plugin: [promise-function-async] Allow async get/set (#820) (cddfdca)
  • eslint-plugin: [require-await] Allow concise arrow function bodies (#826) (29fddfd)
  • eslint-plugin: [typedef] don't flag destructuring when variables is disabled (#819) (5603473)
  • eslint-plugin: [typedef] handle AssignmentPattern inside TSParameterProperty (#923) (6bd7f2d)
  • eslint-plugin: [unbound-method] Allow typeof expressions (Fixes #692) (#904) (344bafe)
  • eslint-plugin: [unbound-method] false positive in equality comparisons (#914) (29a01b8)
  • eslint-plugin: [unified-signatures] type comparison and exported nodes (#839) (580eceb)
  • eslint-plugin: readme typo (#867) (5eb40dc)
  • typescript-estree: improve missing project file error msg (#866) (8f3b0a8), closes #853

Features

  • [no-unnecessary-type-assertion] allow as const arrow functions (#876) (14c6f80)
  • eslint-plugin: [expl-func-ret-type] make error loc smaller (#919) (65eb993)
  • eslint-plugin: [no-type-alias] support tuples (#775) (c68e033)
  • eslint-plugin: add quotes [extension] (#762) (9f82099)
  • typescript-estree: Accept a glob pattern for options.project (#806) (9e5f21e)
Commits

The new version differs by 31 commits.

  • 6849dc8 chore: publish v2.1.0
  • 989c13a docs(eslint-plugin): [efrt] fix default values in docs
  • 65eb993 feat(eslint-plugin): [expl-func-ret-type] make error loc smaller (#919)
  • 6bd7f2d fix(eslint-plugin): [typedef] handle AssignmentPattern inside TSParameterProperty (#923)
  • a4e625f fix(eslint-plugin): [no-inferrable-types] ignore optional props (#918)
  • 29a01b8 fix(eslint-plugin): [unbound-method] false positive in equality comparisons (#914)
  • 344bafe fix(eslint-plugin): [unbound-method] Allow typeof expressions (Fixes #692) (#904)
  • 5603473 fix(eslint-plugin): [typedef] don't flag destructuring when variables is disabled (#819)
  • 16136f3 docs(eslint-plugin): correct typo in no-unused-vars (#910)
  • 5ab13a8 docs(eslint-plugin): no-var-requires: Add example for ES6 modules (#900)
  • cddfdca fix(eslint-plugin): [promise-function-async] Allow async get/set (#820)
  • 92e2b31 chore(parser): add types field to package.json (#893)
  • 29fddfd fix(eslint-plugin): [require-await] Allow concise arrow function bodies (#826)
  • 6a30de2 docs: update contributors list
  • 2a71023 docs(eslint-plugin): correct typo (#891)

There are 31 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

IE11 - Examples not working

Hi all,

Just wanted to ask if the latest version of vis-network supports IE11? I couldn't find any coverage page on the website. If so, the last two versions I've tried seem to be broken for IE 11 (e.g basic usage example gets a console error SCRIPT5007: Object expected vis-network.min.js (25,36467)

It has to do with the object.extend() method.

Sorry if IE11 is not supported, I didn't know and please feel free to close this issue.

setOption edge color options not updating edge properties

hi.
dynamic option setting with setOptions() not working with edge colors (color.color, color.opacity etc)
though the network.edgesHandler.options gets updated.
network.setOptions({edges:{color:{opacity:0.0}}}).
on init all the parameters are ok afaik.
g

An in-range update of vis-util is breaking the build ๐Ÿšจ

The dependency vis-util was updated from 1.1.4 to 1.1.5.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

vis-util is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โœ… ci/circleci: prepare: Your tests passed on CircleCI! (Details).
  • โœ… ci/circleci: lint_ts: Your tests passed on CircleCI! (Details).
  • โœ… ci/circleci: test: Your tests passed on CircleCI! (Details).
  • โŒ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v1.1.5

1.1.5 (2019-08-13)

Bug Fixes

  • build: extend other Vis libraries (#46) (9b8d8c3)
  • include polyfills in built files (#38) (8f8bde9)
  • is-valid-rgb: bring the behavior in line with isValidRGBA (#35) (5dc3adb)
  • is-valid-rgba: pass more valid and less invalid values + test (#31) (047b0e7)
  • types: fix parseColor related types + test (#32) (3b220fc)
  • objects with constructor property in deepExtend + test (#23) (34ca3b7)
  • prevent isValidRGB from passing invalid RGB strings (#28) (ef52283)
Commits

The new version differs by 19 commits.

  • b85a72d style: reformat (#48)
  • 9b8d8c3 fix(build): extend other Vis libraries (#46)
  • 950b00d style: remove Prettier parser (#45)
  • c545b52 chore(package): update dependencies to enable Greenkeeper ๐ŸŒด (#43)
  • 04ea48d ci: set it up (#41)
  • 8f8bde9 fix: include polyfills in built files (#38)
  • 68c578b test: throttle (#30)
  • 5dc3adb fix(is-valid-rgb): bring the behavior in line with isValidRGBA (#35)
  • 48ae980 test: add binarySerchCustom test (#36)
  • 047b0e7 fix(is-valid-rgba): pass more valid and less invalid values + test (#31)
  • 92dc6ef test: add *ClassName tests (#34)
  • f4cdcc6 test: getAbsolute* (#33)
  • 3b220fc fix(types): fix parseColor related types + test (#32)
  • fe6e9e2 test: addEventListener and removeEventListener (#29)
  • 929ab28 test: add hexToRGB test (#25)

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Remove Shapes4FREE icons

The documentation uses external link icons from Shapes4FREE. The Shapes4FREE License is not an open source license (does not allow redistribution). There are comparable icons available from open source icon libraries. For example, Feather has a nice external link icon and an MIT License. Font Awesome also has some external link icons and a CC-BY-4.0 license for those, and there are likely other open source projects with similar icons. Alternatively, Unicode has the โ†ช character, which is often used to denote external links, though it's not as familiar.

Would you consider replacing the Shapes4FREE icons with open source icons?

Updating edges ends in hierarchical layout doesn't reset the layout

If one decides to update the from or to property of an edge, the hierarchical layout might have to be recomputed. This behavior is currently not supported.
Here is an example:
https://jsfiddle.net/57j0pugd/
Just click on the update button and you'll see the behavior. Calling setupHierarchicalLayout fixes it after a redraw.

My understanding of the problem is that Edge.setOptions() doesn't return true when from or to is changed. So this call in EdgesHandler.update() at (1) returns false:

  update(ids) {
    var edges = this.body.edges;
    var edgesData = this.body.data.edges;
    var dataChanged = false;
    for (var i = 0; i < ids.length; i++) {
      var id = ids[i];
      var data = edgesData.get(id);
      var edge = edges[id];
      if (edge !== undefined) {
        // update edge
        edge.disconnect();
// (1)
        dataChanged = edge.setOptions(data) || dataChanged; // if a support node is added, data can be changed.
        edge.connect();
      }
      else {
        // create edge
        this.body.edges[id] = this.create(data);
        dataChanged = true;
      }
    }

    if (dataChanged === true) {
      this.body.emitter.emit('_adjustEdgesForHierarchicalLayout');
      this.body.emitter.emit("_dataChanged");
    }
    else {
      this.body.emitter.emit("_dataUpdated");
    }
  }

Then it only emits '_dataUpdated' which doesn't trigger a call to LayoutEngine.setupHierarchicalLayout(), which I assume is the function that would reset the layout.

So we could add a listener on '_dataUpdated' in LayoutEngine, but I think the problem could also come from Edge.setOptions(). Shouldn't a change to the from or to property of an edge be considered a change to the data, and Edge.setOptions() return true in this case ?

adopt pull-requests fom vis and visjs-network

I can't seem to change node label color and size at the same time.

So I'm using this code to try to change node size/label color on click:

network.body.nodes[id].options.size = newSize;
network.body.nodes[id].options.font.color = newColor;

Then I follow it with:

network.body.emitter.emit('_dataChanged');
network.redraw();

The problem is that if I call network.body.emitter.emit('_dataChanged'), the node size no longer changes, but label color changes. If I don't call it, node size changes, but label color no longer changes.

Is this a bug? What is the proper way to change node size/label color at the same time?

Googling and searching on stack overflow yield few results and a bunch of 404 links to old Vis JS doc/example links that are now down.

Thanks!

clickToUse error?

Hi - I'm using v5.4.1. I'm using timeline and network in the same UI. When I set clickToUse to true I get the following error on first click... Any ideas? Thanks.

bundle.js:91678 Uncaught TypeError: e.stopPropagation is not a function
    at no._onTapOverlay (bundle.js:91678)
    at le.emit (bundle.js:91708)
    at re.emit (bundle.js:91708)
    at re.tryEmit (bundle.js:91708)
    at recognize (bundle.js:91708)
    at le.recognize (bundle.js:91708)
    at F.C [as callback] (bundle.js:91708)
    at F.handler (bundle.js:91708)
    at domHandler (bundle.js:91708)
no._onTapOverlay @ bundle.js:91678
emit @ bundle.js:91708
emit @ bundle.js:91708
tryEmit @ bundle.js:91708
recognize @ bundle.js:91708
recognize @ bundle.js:91708
C @ bundle.js:91708
handler @ bundle.js:91708
domHandler @ bundle.js:91708
bundle.js:91678 Uncaught TypeError: e.stopPropagation is not a function
    at Array.<anonymous> (bundle.js:91678)
    at le.emit (bundle.js:91708)
    at ie.emit (bundle.js:91708)
    at ie.tryEmit (bundle.js:91708)
    at ie.<anonymous> (bundle.js:91708)
    at bundle.js:91708

Error with Angular 8 - 'allowSyntheticDefaultImports' flag

I just updated from vis to vis-network (I only need vis-network since I only use graph in my app) while updating to Angular 8. When I try and compile the app, I get an error:

This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

in ../node_modules/vis-network/dist/types/index.d.ts:18:25.
Complete error:

ERROR in ../node_modules/vis-network/dist/types/index.d.ts:18:25 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

18 import * as moment from './module/moment';

../node_modules/vis-network/dist/types/module/moment.d.ts:1:8 - error TS1259: Module '"%LOCATION%/angular/node_modules/moment/moment"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import moment from 'moment'

../node_modules/moment/moment.d.ts:736:1
736 export = moment;

This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

vis-network version: 5.2.1
Browser: Chrome 76.0.3809.100, Windows 10

My tsconfig.json:

"downlevelIteration": true,
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
    "node_modules/@types"
],
"lib": [
    "es2016",
    "dom"
],
"paths": {
    "core-js/es7/reflect": ["../node_modules/core-js/proposals/reflect-metadata"],
    "core-js/es6/*": ["../node_modules/core-js/es/*"],
    "core-js/es7/*": ["../node_modules/core-js/es/*"]
}

My package.json (omitted Angular stuff):

--- Angular stuff 8.2.2
"core-js": "3.2.1",
"file-saver": "2.0.2",
"ng2-pdf-viewer": "5.3.3",
"ngx-moment": "3.4.0",
"node-sass": "4.12.0",
"numbro": "2.1.2",
"rxjs": "6.5.2",
"typescript": "3.5.3",
"vis-network": "5.2.1",
"web-animations-js": "2.3.2",
"xlsx": "0.15.0",
"zone.js": "0.9.1"

Intermittent issue with afterDrawing event

Hi Team,

I am using the "afterDrawing" event to draw images over nodes using the 'drawImage' method on the passed in canvas context. We are finding that at times the images intermittently dissapear and its difficult to track down why as it is not consistenly repeatable.

They can dissapear just by clicking on the canvas or a node or an edge or by resizing the window. Sometimes by navigating to another tab and back again. Whenever they dissapear clicking again anywhere on the canvas causes them to reappear and it functions as normal until they next time they drop off.

It would appear that there is a chance somewhere within vis.network the callback isnt being triggered or some sort of re-draw occurs before the images can be applied which doesnt subsequently call the afterDrawing callback.

This is the code block that draws the images for reference.

this.visNetwork.on("afterDrawing", (ctx: CanvasRenderingContext2D) => {
            let nodeHeight: number;
            let imageObj: HTMLImageElement;

            const boundBoxes = {};
            const ids = this.ftData.nodes.map((node:any) => {
                boundBoxes[node.id] = this.visNetwork.getBoundingBox(node.id);
                return node.id;
            });
            const positions = this.visNetwork.getPositions(ids);

            this.ftData.nodes.forEach((node: ft_node) => {
                if (!node.hidden) {
                    imageObj = new Image();
                    imageObj.src = node.icon;
                    nodeHeight = FTUtility.getNodeHeight(boundBoxes[node.id]) / 2;
                    ctx.drawImage(imageObj, positions[node.id].x - 20, positions[node.id].y - (12 + nodeHeight), 40, 40);
                }
            });
        });

Any advise on the potential cause would be wonderful.

Kind regards,
Derrick

Importing DataSet module in javascript in latest release

I installed the latest (5.1.0) vis-network using npm, and I am using it in a react project. When I was using v.4.20.1, in my visjs component, I would do the following:

componentDidMount() { 
	this.mounted = true;

	var DataSet = require('../../node_modules/vis/lib/DataSet');
	var Network = require('../../node_modules/vis/lib/network/Network');
	nodesDataset = new DataSet(this.state.graph.nodes);		
	edgesDataset = new DataSet(this.state.graph.edges);

	var data = {
		nodes: nodesDataset,
		edges: edgesDataset
	};
	network = new Network(this.refs.network, data, options);
}

However, in the new repo, there doesn't seem to be a DataSet.js that I could import. Is there another way I could go about using the latest vis.js to create a network in my react project? (I am relatively new to javascript)

Thank you

adopt open pull-requests from almende/vis is usefull

Need update to subdependencies bootstrap and jquery

Hi visjs team,

I have gotten to this page from being referred to by @mojoaxel who I found through your github page. I am filing an issue to update some of vis-networkโ€™s subdependencies. The ones in particular are bootstrap and jquery. Our risk team here at paypal has deemed these versions of the libraries you guys are utilizing to be potentially vulnerable and are not allowing them to pass the ECI check scripts. Please advise on how I can raise the version of bootstrap to 3.4.1 or higher and having at least the latest version of jquery 1.x.x or 2.x.x. Please and thank you for your time. Please see the attached screenshot for reference. Thanks again!
browser: chrome(not a frontend issue so not relevant in my opinion)
This screenshot reveals visjs(4.21.0) but when I tried it with vis-network(5.0.0) it was utilizing the same versions of these libraries.
Screen Shot 2019-07-23 at 8 31 24 PM

Best Regards,

Joseph Kwon

hierarchical directed layout: edge crossing

The edge crossing bug seems to be known but it still would be nice if it gets fixed or at least if one could toggle if he want "optimazation but crossing" or "no crossing but no optimization" mentioned here.

Maybe this is to some degree related to #83.

Not working example changingClusteredEdgesNodes - edge color not changing

I tried example from https://visjs.github.io/vis-network/examples/network/other/changingClusteredEdgesNodes.html but it didn't work as expected for updating edges. Clicking an edge, no matter clustered or not, did not changed it color to red (on Chrome, FF, Safari).

It looks like Clustering.updateEdge() method does not update the color of the edge, but works for changing stuff like value and label of the edge. Not sure if this is intended behavior or not

multi-touch support

hi feature request:
would be great to be able to add multitouch support on network visualizations. Dragging multiple nodes would give a nice ux boost.
if this can be done in current versions, please ignore, i haven't found it.
best. g

Canvas height problem (resize)

Hi,

I'm having a strange bug with vis-network (last version) and the canvas. I'm using Firefox Developer Edition on Windows 7. Here is a preview:

1vis
2vis

We can see that the container is exactly the same size as the canvas. The AutoResize property is set to false, the width and height are set to 100%. From the initialization, we can see that the canvas has 4 size properties.

3vis

I have a button used to enable/disable physics. Every time I press this button, the canvas height is increased by 10px/20px. height: 100% does not work any more and the canvas can grow indefinitely.

this.physics.click(function (e) {

    if (!defaultButtonAction(e, $(this).parent())) return;

    Network.setOptions({physics: {enabled: !Network.physics.physicsEnabled}});
});

4vis

So I write a function called on afterRedraw event. I use sizes.oldWidth and sizes.oldHeight as parameter.

[...]
element: $(".vis-network canvas);
resize: function(w = "500px", h = "500px") {

    if (this.element) this.element.width(w).height(h);
},
[...]

But now when I press the button, the canvas height switch between 503px and 506px. So, when the canvas height is 503px, there is a line never cleared between the canvas and the container.

5vis

It would be better to be able to use height: 100% instead of forcing the canvas to keep the same px size. Do you have any idea how to make height fixed without px ?

vis-network hierarchical sortMethod/level/layout issue

Screen Shot 2019-08-28 at 7 30 22 PM
Does this pull request also fixes this layout issue I am seeing with my graph in the screenshot, it is assigning the 'END' node (shown by the pointer) to it's highest/upper most possible level. A lot of node points to the End node, and it would be good have the lowest position assigned to it.

Also, is there a way I can pass my own sorting method in addition to 'hubsize', 'directed'?

bundle css with rollup

CSS bundling should be done with rollup (like e.g. in the timeline).
At the moment vis-charts completely ignores vis-timeline styles and don't bundles them.

install a greenkeeper

we should install a greenkeeper bot that auto-updates dependencies. This is especially important for dependencies on vis-util or vis-data.

Edge arrow improperly aligned when smooth type is cubicBezier

Steps To Reproduce
*edge smooth type is set to cubicBezier

smooth: {
  enabled: true,
  type: 'cubicBezier'
}
  • enable arrow on middle of the edge
arrows: {
  middle: {
    enabled: true,
  }
},

Expected Behaviour
Arrow should be placed at the centre of the edge

Actual Behaviour
Arrow is placed either above or below the edge

Basic Information
browser: Chromium (74.0)
OS: Linux (Ubuntu 16.04)

Code Example
fiddle example

Screenshots
arrow_alignment

build broken with vis-network 5.2.4

After updating vis-network to 5.2.4 in my angular project i keep getting build errors on util.d.ts in the vis-util library inside the node_modules of vis-network.

ERROR in node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(214,61): error TS1005: ',' expected. node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(214,62): error TS1005: ',' expected. node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(215,64): error TS1005: ',' expected. node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(215,65): error TS1005: ',' expected. node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(223,52): error TS1005: ',' expected. node_modules/vis-network/node_modules/vis-util/dist/types/util.d.ts(223,53): error TS1005: ',' expected.

I've tried to also install vis-util 1.1.6 in my own project but that did not help.
So how can i fix this problem? or is this something you guys need to fix in the build itself?

Init Load Zoom - Network.Js 5.2.1

Hi all,

Since the last update [email protected]/dist/vis-network.min.js, the fit() method and subsequently the initial zoom during network init seems to be broken and focusing on random places within the network.

Reverted back to the 5.2.0 and everything works fine, so it seems this has to do with the latest push.

Let me know if you need any additional information.

Thanks,
George

clickToUse: mouseDown instead of mouseUp

Hey,
the clickToUse option is really helpfull and overall a nice feature. Especially if the graph is embedded in a page where you have to scroll so you can scroll through the page without accidently zooming in or out the graph.
However, if one wants to move around elements in the graph and has to select it first it just feels bad.
So instead of having the graph selected once the users click is done (so on the MouseButtonRelease or MouseButtonUp event) it would be nice to have it select already on the MouseButtonPress or MouseButtonDown event.
An option where you can switch between default and "new" behavior would maybe be the best.

Unable to remove circular 'handle'

Heya,

I'm trying to remove a circular 'handle' from the graph as seen in the screenshot on the right-hand side of the middle node.

Screenshot 2019-07-24 at 11 24 24

Apologies, as it's a question phrased as a bug report, but I've gone through all the options in the docs and I can't find one which removes this circle!

I'm running the latest code from github with the following config (all interaction should be disabled):

note: the circle is present even when options = {}

var options = {
    clickToUse: false,
    configure: {
      enabled: false
    },
    edges: {
      smooth: {
        type: 'cubicBezier',
        forceDirection: 'vertical',
        roundness: 0.4
      }
    },
    layout: {
      hierarchical: {
        enabled: true,
        direction: 'UD'
        // sortMethod: 'directed'
      }
    },
    physics: {
      enabled: false
    },
    interaction: {
      dragNodes: false,
      dragView: false,
      hoverConnectedEdges: false,
      selectConnectedEdges: false,
      multiselect: false,
      selectable: false,
      zoomView: false
    },
    enabled: {
      enabled: false
    },
    manipulation: {
      enabled: false
    },
    groups: {
      useDefaultGroups: false
    }
  }

Shadow had been overlap on image SVG!

Hi all,
I have a problem when using shadow in Visjs network.
When I zoom out the node have the image. It had been overlapped by shadow. So how can I fix this?

68958223_1073690382824092_1167782087156039680_n

Browser: IE 11
Version: 11.678.17763.0

hierarchical directed layout: wrongly directed arrows

The fiddle below is using vis.js as vis-network seems to be not yet available on cdnjs, however this is not working on the current vis-network version either.

As you can see on this jsfiddle not strictly hierarchical networks do not very well with vis atm. It seems that the levels given to the diferent nodes by vis are not quite.. right.
The first network shows nodes without the level argument given, the second one below with level given. Without explicit level the result is just wrong: crossing edges and even wrong levels. (In up direction a child node should never be above its parent node ^^)

The edge crossing seems to be known but it still would be nice if it gets fixed or at least if one could toggle if he want "optimazation but crossing" or "no crossing but no optimization" mentioned here.
Concerning the wrong direction for some nodes I did not find any related issue.

Im not sure if it can help here, but it seems like for larger graphs without level given the order of edges does alter the resulting graph significantly. (I will update the issue with an example as soon as I got one or maybe better open another one, as it may be a totally different thing.)

Without having looked into the code, I assume the graph engine isnt sorting the edges it is given properly in order to assign them their final level in the graph, thus nodes are placed on wrong levels resulting in wrongly directed arrows/edges.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.