Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

From cytoscape via cyREST to cytoscape.js and setting curve-style ... #47

Open
mjoppich opened this issue Oct 7, 2016 · 0 comments
Open

Comments

@mjoppich
Copy link

mjoppich commented Oct 7, 2016

Hi,

If I understand the cytoscape.js doc correctly, one should set curve-style to "Bezier" (or something different than 'haystack') if one wants to see arrows.

Now from py2cytoscape, I do not see any VisualProperty that would set this value in my style. Reason for this probably is that cytoscape itself does not have this property, so cyREST does not have it either ...

Below is a minimal example (not tested, but you get an idea of what I mean) for some CyNetwork net1.

cy.layout.apply(name="force-directed", network=net1)
cy.layout.fit(network=net1)   

#this gets the Directed style from cytoscape via REST api and shows in cytoscape WITH ARROWS!       
my_style = cy.style.create('Directed')

#this transforms the cytoscape style to json for cytoscape.js
style_for_widget = cy.style.get(my_style.get_name(), data_format='cytoscapejs')

cy.style.apply(style=my_style, network=net1)   

#quick and dirty fix for the API problem
#style_for_widget['style'][2]['css']['curve-style'] = 'bezier'

#this shows a nice cytoscape.js graph WITHOUT arrows
renderer.render(net1.get_first_view(), layout_algorithm="cose", style=style_for_widget['css'], background='#FFFFFF')

I wonder whether this is intended behaviour or not? For sure one can fix this by directly setting the curve-style for cytoscape.js - but that is kind of ugly in my opinion ...

Maybe adding a dummy VisualProperty could help - that might be stored locally (in python) and added once the style is asked for in cytoscapejs format (style_util .get or so).

Cheers,

Markus

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

1 participant