Skip to content

Instantly share code, notes, and snippets.

@imgVOID
Last active April 25, 2021 16:58
Show Gist options
  • Save imgVOID/38e12ee7e22deb93444bcbd18bd7b208 to your computer and use it in GitHub Desktop.
Save imgVOID/38e12ee7e22deb93444bcbd18bd7b208 to your computer and use it in GitHub Desktop.
# Установка ссылки на библиотеку D3:
d3_lib_url = "https://d3js.org/d3.v3.min.js"
# Определение JavaScript-функции при помощи Python-строки:
js_string = “””
function draw_circle(div_id, data){
d3.select(div_id)
.append("div")
.style("width", "50px")
.style("height", "50px")
.style("background-color", data.color)
.style("border-radius", "50px")
}
“””
# Исполнение кода с использованием notebookjs:
from notebookjs import execute_js
execute_js([d3_lib_url, draw_circle_lib], "draw_circle", {"color": "#4682B4"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment