Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderer.render method in jupyter-notebook shows an empty graph. #64

Open
shaaaarpy opened this issue Jun 16, 2018 · 8 comments
Open

renderer.render method in jupyter-notebook shows an empty graph. #64

shaaaarpy opened this issue Jun 16, 2018 · 8 comments
Assignees
Labels

Comments

@shaaaarpy
Copy link

When i print the nodes and edges, it shows all the edges, but the render method visualises a blank white screen.
Thank you

@jorgeboucas
Copy link
Member

Hi @sharpy013 please give it a try with:

from py2cytoscape import cyrest
cy=cyrest.cyclient()
cy.result()

@dotasek
Copy link

dotasek commented Aug 3, 2018

I'm trying to do something similar, and I too get a blank screen.

After playing around with it, I suspect that the issue may be that py2cytoscape is still expecting a Cytoscape JS 2.1 data structure.

For example, the following fails when using the data format specified following the most recent Cytoscape JS tutorial:

import json
import py2cytoscape.cytoscapejs as renderer

network = {
            'elements': [ 
              { 'data': { 'id': 'a' } },
              { 'data': { 'id': 'b' } },
              { 'data': { 'id': 'ab', 'source': 'a', 'target': 'b' } }
            ]
          }
    
renderer.render(network=network, height=800, width=800, layout_algorithm='circle', background='#ccffff')

When I turn this into a Cytoscape JS 2.x style format, it runs without exception, but renders nothing:

import json
import py2cytoscape.cytoscapejs as renderer

network = { 'elements': {
              'nodes' : [
                { 'data': { 'id': "a" } },
                { 'data': { 'id': "b" } }
              ],
            'edges' : [
                { 'data': {
                    'id': 'ab',
                    'source': 'a',
                    'target': 'b'
                  }
                }
            ]
            }
          }
renderer.render(network=network, height=800, width=800, layout_algorithm='circle', background='#ccffff')

The code always uses the most recent implementation of Cytoscape JS:

cytoscape: 'https://raw.githubusercontent.com/cytoscape/cytoscape.js/master/dist/cytoscape.min.js'

But there's evidence elsewhere to suggest that the renderer expects Cytoscape JS 2.1:

"target_cytoscapejs_version" : "~2.1",

That would explain why a blank canvas is happening.

@nkmry
Copy link

nkmry commented Aug 6, 2018

I also got an empty graph.
I tried to do the same things in an example code .
My Chrome devtools console said:

Failed to load resource: the server responded with a status of 404 (Not Found) https://raw.githubusercontent.com/cytoscape/cytoscape.js/master/dist/cytoscape.min.js.js?v=20180730133659
Refused to execute script from 'https://raw.githubusercontent.com/cytoscape/cytoscape.js/master/dist/cytoscape.min.js.js?v=20180730133659' because its MIME type ('') is not executable, and strict MIME type checking is enabled.
require.js:140 Uncaught Error: Script error for "cytoscape"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:165)
    at HTMLScriptElement.onScriptError (require.js:1732)
Waiting for Cyjs...

Is the URL of cytoscape.min.js correct?

@jorgeboucas
Copy link
Member

@dotasek check 47a518f & test

help(renderer.render)

@dotasek
Copy link

dotasek commented Aug 7, 2018

I checked, and tested, with the same result. I started my own fork and made enough changes to at least get a JS widget operational. You can see the changes in this commit:

dotasek@f9c0f0b

I'm not ready for a pull request yet; I'll be trying to get as much functionality as I can.

@dotasek
Copy link

dotasek commented Aug 7, 2018

Sample of a Jupyter notebook using the above fork: https://github.com/dotasek/py2cytoscapejs/blob/master/CX%20to%20JS%20Example.ipynb

@AustEcon
Copy link

AustEcon commented Jul 5, 2019

I'm still having the same problem. Will this problem get fixed soon on the master branch?

@sharthZ23
Copy link

Same problem with ipycytoscape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants