facets
facets copied to clipboard
How can facets-dive be integrated with dash-plotly
Basic working example. Though I'd still like to hear your opinion on better integration
import os
import sys
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_dangerously_set_inner_html
DEBUG = True
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
data = pd.read_csv(???)
data = data.to_json(orient='records')
app = dash.Dash('')
app.layout = html.Div(children=[
html.Iframe(
width="1200",
height="800",
srcDoc="""
<link rel="import" href="https://raw.githubusercontent.com/PAIR-code/facets/master/facets-dist/facets-jupyter.html">
<facets-dive id="elem" height="800" width="1200"></facets-dive>
<script>
var data = {jsonstr};
document.querySelector("#elem").data = data;
</script>""".format(jsonstr=data)
),
])
if __name__ == '__main__':
app.run_server(debug=DEBUG)
I don't have any experience with dash-plotly. Did your above code work?
Yes.
Hi @plopd,
Thanks for you post. When I run the code with a local csv file, I get an empty frame. Am I missing some library?
Thanks, Davide