-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: #226 * Add opacity option to nodes * Fix shadow color being mangled * Remove console.log * Change to use util version of overrideOpacity * Fix updating groups instead of node Change import to only import overrideOpacity * Fix local opacity not being applied * Fix wrong property name * Fix drawing selected instead of hovered * Update example * Update example * Fix opacity of 0 wouldn't pass * Fix checks for truthiness instead of nullness Add groups to example * Added to docs KR Docs todo * Update example Fix problems with values invalid for opacity * Update example Fix error logging for invalid node opacity options * Create function to check opacity Clear up comment on opacity option * Fix image opacity transferring to shapes * Remove console.log * WIP: Fix group opacity overriding node opacity * Fix group options overriding local options Co-authored-by: Tyler Maclachlan <[email protected]>
- Loading branch information
1 parent
1cef4a2
commit b9ff848
Showing
11 changed files
with
208 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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,92 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Vis Network | Node Styles | Images with Opacity</title> | ||
|
||
<style type="text/css"> | ||
#mynetwork { | ||
width: 600px; | ||
height: 600px; | ||
border: 1px solid lightgray; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript" src="../../../standalone/umd/vis-network.min.js"></script> | ||
|
||
<script type="text/javascript"> | ||
var nodes = null; | ||
var edges = null; | ||
var network = null; | ||
|
||
var DIR = '../img/refresh-cl/'; | ||
var EDGE_LENGTH_MAIN = 150; | ||
var EDGE_LENGTH_SUB = 50; | ||
|
||
// Called when the Visualization API is loaded. | ||
function draw() { | ||
// Create a data table with nodes. | ||
nodes = []; | ||
|
||
// Create a data table with links. | ||
edges = []; | ||
|
||
nodes.push({id: 1, label: 'Main', image: DIR + 'Network-Pipe-icon.png', shape: 'image', opacity: .7}); | ||
nodes.push({id: 2, label: 'Office', image: DIR + 'Network-Pipe-icon.png', shape: 'image'}); | ||
nodes.push({id: 3, label: 'Wireless', image: DIR + 'Network-Pipe-icon.png', shape: 'image'}); | ||
nodes.push({id: 22, label: 'Normal', opacity: 1}) | ||
edges.push({from: 1, to: 2, length: EDGE_LENGTH_MAIN}); | ||
edges.push({from: 1, to: 3, length: EDGE_LENGTH_MAIN}); | ||
edges.push({from: 1, to: 22, length: EDGE_LENGTH_MAIN}); | ||
|
||
for (var i = 4; i <= 7; i++) { | ||
nodes.push({id: i, label: 'Computer', image: DIR + 'Hardware-My-Computer-3-icon.png', shape: 'image', group: 'computer', opacity: 1}); | ||
edges.push({from: 2, to: i, length: EDGE_LENGTH_SUB}); | ||
} | ||
|
||
nodes.push({id: 101, label: 'Printer', image: DIR + 'Hardware-Printer-Blue-icon.png', shape: 'image'}); | ||
edges.push({from: 2, to: 101, length: EDGE_LENGTH_SUB}); | ||
|
||
nodes.push({id: 102, label: 'Laptop', image: DIR + 'Hardware-Laptop-1-icon.png', shape: 'image'}); | ||
edges.push({from: 3, to: 102, length: EDGE_LENGTH_SUB}); | ||
|
||
nodes.push({id: 103, label: 'network drive', image: DIR + 'Network-Drive-icon.png', shape: 'image'}); | ||
edges.push({from: 1, to: 103, length: EDGE_LENGTH_SUB}); | ||
|
||
nodes.push({id: 104, label: 'Internet', image: DIR + 'System-Firewall-2-icon.png', shape: 'image'}); | ||
edges.push({from: 1, to: 104, length: EDGE_LENGTH_SUB}); | ||
|
||
for (var i = 200; i <= 201; i++ ) { | ||
nodes.push({id: i, label: 'Smartphone', image: DIR + 'Hardware-My-PDA-02-icon.png', shape: 'image'}); | ||
edges.push({from: 3, to: i, length: EDGE_LENGTH_SUB}); | ||
} | ||
|
||
// create a network | ||
var container = document.getElementById('mynetwork'); | ||
var data = { | ||
nodes: nodes, | ||
edges: edges | ||
}; | ||
var options = { | ||
// nodes: { | ||
// opacity: .5 | ||
// }, | ||
groups: { | ||
computer: { | ||
opacity: .3 | ||
} | ||
} | ||
}; | ||
network = new vis.Network(container, data, options); | ||
} | ||
</script> | ||
|
||
|
||
<body onload="draw()"> | ||
|
||
<p> | ||
Display nodes with global opacity, individual opacity, and opacity in a group. | ||
</p> | ||
<div id="mynetwork"></div> | ||
|
||
</body> | ||
</html> |
This file contains 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 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 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 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 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 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
Oops, something went wrong.
Is this for #635 issue?