Skip to content

Commit e438bce

Browse files
authored
Merge pull request #163 from neo4j/export-html
Add docs about exporting HTML to file
2 parents 22ece7f + 174d6e7 commit e438bce

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

docs/source/rendering.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The ``render`` method
2323

2424
Once you have a ``VisualizationGraph`` object, you can render it using the ``render`` method.
2525
This will return a HTML object that will be displayed in an environment that supports HTML rendering, such as
26-
Jupyter notebooks or streamlit.
26+
Jupyter notebooks or streamlit application.
2727

2828
All parameter of the ``render`` method are optional, and the full list of parameters of them is listed in the API
2929
reference: :meth:`neo4j_viz.VisualizationGraph.render`.
@@ -50,7 +50,23 @@ But you can disable this by passing ``show_hover_tooltip=False``.
5050

5151

5252
Examples
53-
--------
53+
~~~~~~~~
5454

5555
Please refer to the :doc:`Getting started section <./getting-started>` and the :doc:`tutorials <./tutorials/index>` for
5656
examples of ``render`` method usage.
57+
58+
59+
Exporting to HTML
60+
~~~~~~~~~~~~~~~~~
61+
62+
The object returned by the ``render`` method is a ``IPython.display.HTML`` object.
63+
In addition to being displayed in a Jupyter notebook or streamlit application, it can also be saved as an HTML file.
64+
This could be useful if you want to share the visualization with others or embed it in a web page.
65+
66+
To save the HTML data to a file, you can use the ``data`` attribute of the HTML object:
67+
68+
.. code-block:: python
69+
70+
html = VG.render(...)
71+
with open("my_graph.html", "w") as f:
72+
f.write(html.data)

0 commit comments

Comments
 (0)