module jspy.render_nb_js_vis

Inheritance diagram of jyquickhelper.jspy.render_nb_js_vis

Short summary

module jyquickhelper.jspy.render_nb_js_vis

Renders a network in Javascript.

source on GitHub

Classes

class

truncated documentation

JavascriptVisError

Raised when the code does not contain what the class expects to find.

RenderJsVis

Renders a network in a notebook with vis.js.

Static Methods

staticmethod

truncated documentation

_build_script

Builds the javascript script.

_get_libs_css

Returns the dependencies.

_options2js

Converts data into a string.

Methods

method

truncated documentation

__init__

Documentation

Renders a network in Javascript.

source on GitHub

exception jyquickhelper.jspy.render_nb_js_vis.JavascriptVisError

Bases: JavascriptScriptError

Raised when the code does not contain what the class expects to find.

source on GitHub

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: RenderJS

Renders a network in a notebook with vis.js.

source on GitHub

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 javascript

  • check_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'.

source on GitHub

__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 javascript

  • check_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'.

source on GitHub

static _build_script(js, dot, **options)

Builds the javascript script.

Parameters:
  • js – javascript

  • dot – dot scripts

  • options – graph options

Returns:

javascript

source on GitHub

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)

source on GitHub

static _options2js(data)

Converts data into a string.

source on GitHub