Comments (2)
I have tested all WebGL dash-bio
components, as well as dash-vtk
with the shared WebGL context, and all seem to be working fine as far as I can tell.
dash-deck
I'm less familiar with; the basic "Hello World" example seems to be loading OK but I haven't yet been able to put together a more comprehensive example to test with.
Sample Dash app used for testing:
import urllib.request as urlreq
import dash
from dash import dcc, html, callback, Input, Output
import dash_bio
from dash_bio.utils import ngl_parser, xyz_reader
import dash_deck
import dash_vtk
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from pyvista import examples
app = dash.Dash(
__name__,
external_scripts=[
"https://unpkg.com/[email protected]/src/virtual-webgl.js", # Enable shared virtual WebGL context
],
)
server = app.server
def layout():
return html.Div(
[
dcc.Dropdown(
id="content-dropdown",
options=[
{"label": x, "value": x}
for x in ["dcc-graph", "dash-bio", "dash-vtk", "dash-deck"]
],
value="dcc-graph",
),
dcc.Loading(html.Div(id="content")),
]
)
@callback(
Output("content", "children"),
Input("content-dropdown", "value"),
)
def select_content(value):
if value == "dcc-graph":
return dcc_graphs_webgl()
elif value == "dash-bio":
return dash_bio_components()
elif value == "dash-vtk":
return dash_vtk_components()
elif value == "dash-deck":
return dash_deck_components()
else:
return html.Div(f"Invalid selection `{value}`")
def dcc_graphs_webgl():
return html.Div(
[
dcc.Graph(figure=go.Figure(data=[go.Scattergl(x=[1, 2, 3], y=[1, 3, 2])])),
]
)
def dash_bio_components():
return html.Div(
[
# # Speck
html.Div("Speck"),
html.Div(
dash_bio.Speck(
id="default-speck",
data=xyz_reader.read_xyz(
datapath_or_datastring=urlreq.urlopen(
"https://git.io/speck_methane.xyz"
)
.read()
.decode("utf-8"),
is_datafile=False,
),
),
style={"border": "2px solid black"},
),
# NglMoleculeViewer
html.Div("NglMoleculeViewer"),
html.Div(
dash_bio.NglMoleculeViewer(
id="default-ngl-molecule",
data=[
ngl_parser.get_data(
data_path="https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Molecular/",
pdb_id="1BNA",
color="red",
reset_view=True,
local=False,
)
],
),
style={"border": "2px solid black"},
),
# AlignmentChart
html.Div("AlignmentChart"),
html.Div(
dash_bio.AlignmentChart(
id="my-default-alignment-viewer",
data=urlreq.urlopen("https://git.io/alignment_viewer_p53.fasta")
.read()
.decode("utf-8"),
height=900,
tilewidth=30,
),
style={"border": "2px solid black"},
),
# ManhattanPlot
html.Div("ManhattanPlot"),
html.Div(
dcc.Graph(
id="default-dashbio-manhattanplot",
figure=dash_bio.ManhattanPlot(
dataframe=pd.read_csv("https://git.io/manhattan_data.csv")
),
),
style={"border": "2px solid black"},
),
]
)
def dash_vtk_components():
return html.Div(
[
# vtk view with point cloud
vtk_view_point_cloud(),
]
)
def vtk_view_point_cloud():
# Get point cloud data from PyVista
dataset = examples.download_lidar()
subset = 0.2
selection = np.random.randint(
low=0, high=dataset.n_points - 1, size=int(dataset.n_points * subset)
)
points = dataset.points[selection]
xyz = points.ravel()
elevation = points[:, -1].ravel()
min_elevation = np.amin(elevation)
max_elevation = np.amax(elevation)
return html.Div(
dash_vtk.View(
[
dash_vtk.PointCloudRepresentation(
xyz=xyz,
scalars=elevation,
colorDataRange=[min_elevation, max_elevation],
property={"pointSize": 2},
)
]
),
style={"height": "400px", "width": "600px"},
)
# How to keep this from taking over entire browser canvas?
def dash_deck_components():
data = {
"description": "A minimal deck.gl example",
"initialViewState": {"longitude": -122.45, "latitude": 37.8, "zoom": 12},
"layers": [
{
"@@type": "TextLayer",
"data": [{"position": [-122.45, 37.8], "text": "Hello World"}],
},
],
}
return html.Div(
dash_deck.DeckGL(data=data, id="deck-gl"),
style={"width": "600px", "height": "400px"},
)
app.layout = layout
if __name__ == "__main__":
app.run_server(debug=True, port=8050)
from dash.
Perhaps @graingert-coef or @vogt31337 could be enticed to test out dash-deck
with virtual webgl, and provide a more complete test case?
from dash.
Related Issues (20)
- How does the new version of dash dynamically create callback HOT 1
- When there are three identical outputs, the allow_duplicate is set and an error will be reported. HOT 5
- dash title design issues HOT 3
- [BUG] When using multiple instances of dash on a flask server, they cannot share the same page name, even though they have different url routes HOT 3
- How does dash combine with flask jwt? HOT 1
- The problem of parameter transparency between dash custom components HOT 1
- Running argument in a callback breaks when provided with a dictionary as an component_id instead of a string HOT 2
- [BUG] Dash Testing: `wait_for_text_to_equal` may incorrectly succeed when used with text `"None"` HOT 1
- [Feature Request] Allow dcc.Dropdown with multi=True to stay open when item is selected HOT 3
- Can callback be set to take effect with the current page or globally HOT 1
- [BUG] Using gunicorn to deploy a dash app with plotly-resampler in Linux, and the figure didnt render correctly
- [BUG] cannot pickle 'SSLContext' with background callback HOT 5
- [BUG] A progress callable of a bg callback sometimes doesn't trigger. HOT 2
- [BUG] dcc.Clipboard functionality broken in Notification component HOT 6
- [Feature Request] Ability to specify order of components when using pattern-matching wildcards (ALL) HOT 1
- [Feature Request] Exporting the dev tool callback graph in a standardized graph format
- [BUG] Use of `dash_duo` hangs Github Action until Timeout HOT 1
- [BUG] dbc.Modal(style) is passed to fade-modal-show layer instead modal HOT 1
- [BUG] Persistence failed in component type props
- [BUG] JSON Parse error when using dash_ag_grid and dash pages HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.