Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

options-edges-color-inherit-to not working? #3350

Closed
sawatts opened this issue Aug 7, 2017 · 3 comments
Closed

options-edges-color-inherit-to not working? #3350

sawatts opened this issue Aug 7, 2017 · 3 comments

Comments

@sawatts
Copy link

sawatts commented Aug 7, 2017

VIS.JS 4.20.1

Network of nodes with simple edges. Using options to specify that edges should be coloured according to their destination (options.edges.color.inherit = "to"). Edges are still coloured by according to their "from" node.

The network is defined in JSON (currently embedded in the JSP hosting the network - this will change).

The options are pulled from the server as a JSON file and loaded into the network object after it is created (immediately after), using an XMLHttpRequest call with network.setOptions(o) ; network.redraw(); as the consumer function.

I thought that the edges were coloured correctly (as "to") - so its possible that the error in the consumer or setOptions? The rest of the configuration options are applied correctly.

The options.json being loaded is minimal, as follows:

{
	"edges" : { "color" : { "inherit" : "to" } },
	"groups" :
	{
		"Group1" : {},
		"Group2" : {},
		"Group5" : 
		{
			"icon"  :
			{
				"face" : "FontAwesome",
				"code" : "\uf013",
				"size" : 20
			},
			"shape" : "icon"
		},
		"Group6" : {}
	}
}

Tested on Windows 7 x64 with:

  • Chrome 60.
  • Firefox 54.
@wimrijnders
Copy link
Contributor

I did a quick test on the basicExample example of network, option edges.color.inherit: 'to' appears to be working correctly.

I made a jsbin of this; can you look at it and see if you can change it to illustrate your issue?

@sawatts
Copy link
Author

sawatts commented Aug 15, 2017

I reproduced the issue from your example by setting the options after the network is created:

  var network = new vis.Network(container, data, {});
  network.setOptions (options);

Node 1 has edges to nodes 2 and 3, which should be coloured green and red respectively (and are so when the network is created with the options). When the options are applied after creation, the edges are colours blue as node 1.

@wimrijnders
Copy link
Contributor

I've been looking into this, there is definitely an issue here with several things going wrong.

I have trouble wrapping my mind around the option handling, it's quite tricky. This might take a while.

wimrijnders added a commit to wimrijnders/vis that referenced this issue Aug 20, 2017
yotamberk pushed a commit that referenced this issue Aug 23, 2017
* Added commenting for options, refactored choosify()

* Refactored updateLabelModule()

* added comment at node creation

* Completed fix for #3350

* parseOptions() different handling for bridged/extended; unit tests for reversal of options

* Fixes on linting and unit testing
primozs pushed a commit to primozs/vis that referenced this issue Jan 3, 2019
)

* Added commenting for options, refactored choosify()

* Refactored updateLabelModule()

* added comment at node creation

* Completed fix for almende#3350

* parseOptions() different handling for bridged/extended; unit tests for reversal of options

* Fixes on linting and unit testing
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants