UI revision does not work while specifying projection type
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 18.3k
- Forks
- 2k
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 28
Beschreibung
i’ve been unable to make uirevision to work while using the orthographic projection on 3D scatter plot using graph object.
here’s a simplified example (i'm not as familiar with JS , therefore the example is in python.) :
import dash
from dash import dcc, html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import pandas as pd
from numpy.random import randn
# Sample data
data = {
'sepal_width': [3.5, 3.0, 3.2, 3.1, 3.6],
'sepal_length': [5.1, 4.9, 4.7, 4.6, 5.0],
'petal_length': [1.4, 1.4, 1.3, 1.5, 1.4],
}
data2 = {
'sepal_width': [3.5, 3.0, 3.2, 3.1, 3.6]*3,
'sepal_length': [5.1, 4.9, 4.7, 4.6, 5.0]*2,
'petal_length': [1.4, 1.4, 1.3, 1.5, 1.4]*1,
}
df = pd.DataFrame(data)
# Initial Figure
scatter_figure = go.Figure()
scatter_figure.layout.uirevision = True
scatter_figure.layout.scene.camera.projection.type = 'orthographic'
# Add 3D Scatter Plot Trace
scatter_figure.add_trace(
go.Scatter3d(
x=df['sepal_width'],
y=df['sepal_length'],
z=df['petal_length'],
mode='markers',
marker=dict(
size=12,
opacity=0.7,
),
scene='scene',
)
)
# Dash app
app = dash.Dash(__name__)
# Layout
app.layout = html.Div([
dcc.Graph(
id='scatter-plot',
figure=scatter_figure,
),
dcc.Checklist(
id='toggle-checklist',
options=[
{'label': 'Toggle Plot', 'value': 'toggle'}
],
value=['toggle'],
),
])
# Callback to toggle plot visibility
@app.callback(
Output('scatter-plot', 'figure'),
[Input('toggle-checklist', 'value')]
)
def toggle_plot(value):
if 'toggle' in value:
# If 'toggle' is in the value, show the plot
return scatter_figure
else:
df = data2
scatter_figure.add_trace(
go.Scatter3d(
x=df['sepal_width'],
y=df['sepal_length'],
z=df['petal_length'],
mode='markers',
marker=dict(
size=12,
opacity=0.7,
),
scene='scene',
)
)
return scatter_figure
# Run the app
if __name__ == '__main__':
app.run_server(debug=True,port = 8078)
every time I'm toggling the check box the view completely reversed to its original position, and only when I'm specifying projection to be orthographic , works perfectly on perspective.
I'd really appeiciate you looking into this :)
Happy New Year and thanks in advance.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der bereitgestellten Dash/Python-Reproduktion und konzentriere dich auf das Verhalten von uirevision beim 3D-Streudiagramm, wenn scene.camera.projection.type auf orthografisch gesetzt ist. Vergleiche das Umschalten der Checkliste unter orthografischen und perspektivischen Projektionen; als abgeschlossen gilt die Aufgabe, wenn die Kameransicht beim Umschalten des Plots an ihrer aktuellen Position bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100