UI revision does not work while specifying projection type
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 18.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 28
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với bản tái hiện Dash/Python được cung cấp, tập trung vào hành vi của uirevision trong biểu đồ phân tán 3D khi scene.camera.projection.type được đặt thành orthographic. So sánh việc chuyển đổi checklist giữa các phép chiếu trực giao và phối cảnh; được xem là hoàn tất khi chế độ xem camera vẫn ở vị trí hiện tại khi chuyển đổi plot.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100