module jspy.render_nb_js_vis
¶
Classes¶
class |
truncated documentation |
---|---|
Raised when the code does not contain what the class expects to find. |
|
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Builds the javascript script. |
|
Returns the dependencies. |
|
Converts data into a string. |
Documentation¶
Renders a network in Javascript.
-
exception
jyquickhelper.jspy.render_nb_js_vis.
JavascriptVisError
¶ Bases:
jyquickhelper.jspy.render_nb_js.JavascriptScriptError
Raised when the code does not contain what the class expects to find.
-
class
jyquickhelper.jspy.render_nb_js_vis.
RenderJsVis
(js=None, local=False, width='100%', height='100%', divid=None, style=None, only_html=True, div_class=None, check_urls=True, class_vis='Network', dot=None, layout=None, direction='UD')¶ Bases:
jyquickhelper.jspy.render_nb_js.RenderJS
Renders a network in a notebook with vis.js.
- Parameters
js – (str) javascript
local – (bool) use local path to javascript dependencies
script – (str) script
width – (str) width
height – (str) height
style – (str) style (added in
<style>...</style>
)divid – (str|None) id of the div
only_html – (bool) use only function display_html and not display_javascript to add javascript to the page.
div_class – (str) class of the section
div
which will host the results of the javascriptcheck_urls – (bool) by default, check url exists
class_vis – (str) visualization class (Network, Timeline, …)
dot – (str) either js or dot must be specified.
layout – (str) layout see layout
direction – (str) if
layout=='hiearchical'
, a string among ‘UD’, ‘DU’, ‘LR’, ‘RL’.
The script must defined variables options and data if
class_vis=='Network'
.-
__init__
(js=None, local=False, width='100%', height='100%', divid=None, style=None, only_html=True, div_class=None, check_urls=True, class_vis='Network', dot=None, layout=None, direction='UD')¶ - Parameters
js – (str) javascript
local – (bool) use local path to javascript dependencies
script – (str) script
width – (str) width
height – (str) height
style – (str) style (added in
<style>...</style>
)divid – (str|None) id of the div
only_html –
(bool) use only function display_html and not display_javascript to add javascript to the page.
div_class – (str) class of the section
div
which will host the results of the javascriptcheck_urls – (bool) by default, check url exists
class_vis – (str) visualization class (Network, Timeline, …)
dot – (str) either js or dot must be specified.
layout –
(str) layout see layout
direction – (str) if
layout=='hiearchical'
, a string among ‘UD’, ‘DU’, ‘LR’, ‘RL’.
The script must defined variables options and data if
class_vis=='Network'
.
-
static
_build_script
(js, dot, **options)¶ Builds the javascript script.
- Parameters
js – javascript
dot – dot scripts
options – graph options
- Returns
javascript
-
static
_get_libs_css
(local, class_vis)¶ Returns the dependencies.
- Parameters
local – use local file (True) or remote urls (False)
lite – use lite version
- Returns
tuple (libs, css)
-
static
_options2js
(data)¶ Converts data into a string.