This repository was archived by the owner on Jul 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[network] image shape: add optional selected image #2601
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <html> | ||
| <head> | ||
| <title>Network | Selected/Unselected Image</title> | ||
|
|
||
| <script type="text/javascript" src="../../../dist/vis.js"></script> | ||
| <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" /> | ||
|
|
||
| <style type="text/css"> | ||
| body { | ||
| font: 10pt arial; | ||
| } | ||
| #mynetwork { | ||
| width: 600px; | ||
| height: 600px; | ||
| 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, | ||
| shape: 'image', | ||
| size: 20, | ||
| label: 'No select image', | ||
| image: './unselected.svg', | ||
| }, { | ||
| id: 2, | ||
| shape: 'image', | ||
| size: 20, | ||
| label: 'Select image broken', | ||
| image: { | ||
| unselected: './unselected.svg', | ||
| selected: './BROKEN_LINK/selected.svg', | ||
| }, | ||
| }, { | ||
| id: 3, | ||
| shape: 'image', | ||
| size: 20, | ||
| label: 'Select works!', | ||
| image: { | ||
| unselected: './unselected.svg', | ||
| selected: './selected.svg', | ||
| }, | ||
| shapeProperties: { | ||
| borderDashes: [15, 5], | ||
| interpolation: false, | ||
| } | ||
| }]); | ||
|
|
||
| // create an array with edges | ||
| var edges = new vis.DataSet([ | ||
| {from: 1, to: 2}, | ||
| {from: 2, to: 3}, | ||
| ]); | ||
|
|
||
| // create a network | ||
| var container = document.getElementById('mynetwork'); | ||
|
|
||
| // provide the data in the vis format | ||
| var data = { | ||
| nodes: nodes, | ||
| edges: edges | ||
| }; | ||
|
|
||
| var options = { | ||
| layout:{ | ||
| randomSeed: 5 | ||
| }, | ||
| nodes: { | ||
| brokenImage: './broken-image.png', | ||
| } | ||
| }; | ||
| // initialize! | ||
| var network = new vis.Network(container, data, options); | ||
| </script> | ||
|
|
||
| </body> | ||
| </html> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a unnecessary comma. Probably my mistake!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mehl321 You don't have to change this of course, but you can if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You decide :) I like to use trailing commas as part of my code style because all lines look the same and you can safely copy-paste them. Really it's up to you, depending on the code style of vis.js.