Skip to content

JavaScript

plotjs offers a few utility functions to work with JavaScript, and a guide on how to work with JavaScript.

Warning

You likely just want to use the add_javascript() method from the PlotJS object instead of the following functions. Those are used under the hood and you can use them, but they might not provide you the simplest interface.


plotjs.javascript.from_file(javascript_file)

Get raw javascript from a javascript file. This function just reads the js from a given file.

Parameters:

Name Type Description Default
javascript_file str

Path to a js file.

required

Returns:

Type Description
str

A string of raw javascript.

Examples:

from plotjs import javascript

javascript.from_file("path/to/script.js")