Ejemplo n.º 1
0
def d3_output(response, visid, width, height):
    results = json.loads(response)
    d3js = results["js"]
    d3css = results["css"]
    controls = results["controls"]
    html = D3_TEMPLATE_HTML.render({
        'jsloc': brunel_util.JS_LOC,
        'd3css': d3css,
        'visId': visid,
        'width': width,
        'height': height
    })
    # side effect pushes required D3 HTML to the client
    ipydisplay(HTML(html))
    widgets = brunelWidgets.build_widgets(controls, visid)
    if (widgets is not None):
        # Push widgets & D3 JS
        js = D3_TEMPLATE.render({
            'jsloc': brunel_util.JS_LOC,
            'd3loc': brunel_util.D3_LOC,
            'd3js': d3js,
            'controls': widgets['wire_code']
        })
        return ipydisplay(widgets['widget_box'], Javascript(js))
    else:
        js = D3_TEMPLATE.render({
            'jsloc': brunel_util.JS_LOC,
            'd3loc': brunel_util.D3_LOC,
            'd3js': d3js,
            'controls': ""
        })
        return Javascript(js)
Ejemplo n.º 2
0
def d3_output(response, visid, width, height):
    results = json.loads(response)
    d3js = results["js"]
    d3css = results["css"]
    controls = results["controls"]
    html = D3_TEMPLATE_HTML.render(
        {"jsloc": brunel_util.JS_LOC, "d3css": d3css, "visId": visid, "width": width, "height": height}
    )
    # side effect pushes required D3 HTML to the client
    ipydisplay(HTML(html))
    widgets = brunelWidgets.build_widgets(controls, visid)
    if widgets is not None:
        # Push widgets & D3 JS
        js = D3_TEMPLATE.render(
            {
                "jsloc": brunel_util.JS_LOC,
                "d3loc": brunel_util.D3_LOC,
                "topojsonloc": brunel_util.TOPO_JSON_LOC,
                "d3js": d3js,
            }
        )
        return ipydisplay(widgets["widget_box"], Javascript(js))
    else:
        js = D3_TEMPLATE.render(
            {
                "jsloc": brunel_util.JS_LOC,
                "d3loc": brunel_util.D3_LOC,
                "topojsonloc": brunel_util.TOPO_JSON_LOC,
                "d3js": d3js,
            }
        )
        return Javascript(js)
Ejemplo n.º 3
0
def d3_output(response, visid, width, height):
    results = json.loads(response)
    d3js = results["js"]
    d3css = results["css"]
    controls = results["controls"]
    html = D3_TEMPLATE_HTML.render({'jsloc': brunel_util.JS_LOC, 'd3css': d3css, 'visId': visid, 'width': width, 'height': height})
    # side effect pushes required D3 HTML to the client
    ipydisplay(HTML(html))
    widgets = brunelWidgets.build_widgets(controls, visid)
    if (widgets is not None):
        # Push widgets & D3 JS
        js = D3_TEMPLATE.render({'jsloc': brunel_util.JS_LOC, 'd3loc': brunel_util.D3_LOC, 'd3js': d3js, 'controls': widgets['wire_code']})
        return ipydisplay(widgets['widget_box'], Javascript(js))
    else:
        js = D3_TEMPLATE.render({'jsloc': brunel_util.JS_LOC, 'd3loc': brunel_util.D3_LOC, 'd3js': d3js, 'controls': ""})
        return Javascript(js)
Ejemplo n.º 4
0
def d3_output(response, visid, width, height):
    results = json.loads(response.read().decode("utf-8"))
    d3js = results["js"]
    d3css = results["css"]
    controls = results["controls"]
    html = D3_TEMPLATE_HTML.render({"d3css": d3css, "visId": visid, "width": width, "height": height})
    # side effect pushes required D3 HTML to the client
    ipydisplay(HTML(html))
    widgets = brunelWidgets.build_widgets(controls, visid)
    if widgets is not None:
        # Push widgets & D3 JS
        js = D3_TEMPLATE.render({"d3js": d3js, "controls": widgets["wire_code"]})
        return ipydisplay(widgets["widget_box"], Javascript(js))
    else:
        js = D3_TEMPLATE.render({"d3js": d3js, "controls": ""})
        return Javascript(js)