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

Save visualization #1

Open
ccampanile opened this issue Oct 18, 2018 · 4 comments
Open

Save visualization #1

ccampanile opened this issue Oct 18, 2018 · 4 comments

Comments

@ccampanile
Copy link

ccampanile commented Oct 18, 2018

Hi,

I am testing Netwulf on a project and I would like to save the webpage. If I save the page in Chrome it and when re-open it, no graph appears and the UI is frozen.

Is there a proper way to save this from python?

Thank you!
Cheers
Claudio

EDIT: I also tied to open it from ~/.netwulf directly, or through a Chrome web server, but still the same result.

@benmaier
Copy link
Owner

benmaier commented Oct 18, 2018

Hey, though sometimes possible, you should not use the html-file and open it directly with a browser. Rather, you should run a local server. What you could do is the following.

Start the visualization from Python. Now, in ~/.netwulf/, there appeared two files, both something with *tmp_*.json. One of them is the network data and the other one is the configuration data.

Copy the ~/.netwulf directory to some other directory /path/to/other with

cp -r ~/.netwulf/ /path/to/other

Then change to the directory and start a local webserver

cd /path/to/other
python -m "http.server" 1234

Then, in your browser, open

http://localhost:1234/?config=config_filename.json&data_filename.json

where config_filename.json should be replaced with the config file in /path/to/other and similarly with data_filename.json.

When your question is "I want to save the current configuration", currently there's no other way to use the controls on top of the GUI. You can directly access the config json by clicking on the small gear wheel though. This might change in the future.

@ulfaslak
Copy link
Collaborator

But like in webweb, could we not have a feature "Save to HTML" that creates a standalone html file which people can put in their keynote presentations and web-based research papers? Maybe this should be done on the JavaScript side, but I imagine it's possible and useful in many cases.

@benmaier
Copy link
Owner

I've recently added an export feature to github.com/benmaier/tacoma, so it is feasible, but one still would have to start a webserver to view the page -- the reason being that javascript does not load files if it is not run from a server. In webweb, they put all the sources (d3, colors, network data) in a single HTML file, apparently that's why it works. Do we want that?

@benmaier
Copy link
Owner

apparently there's some arguments against loading data as raw JavaScript, they would, however, not directly apply to us: https://betterexplained.com/articles/using-json-to-exchange-data/ . Mostly security reasons

I still think it'd a bit messy though :)

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

No branches or pull requests

3 participants