plotly / plotly/plotly.py

with `plotly.offline.plot` add `iframe` to `output_type` to render an isolated version of outputs inside iframe

Abierto
#4,552 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

feature P3
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

I searched existing issues and didn't find any issues suggestion this feature before.

This is an idea to solve the problem of rendering databricks notebooks inside VSCode with Plotly.

Based on https://docs.databricks.com/en/visualizations/plotly.html, databricks suggest we use plotly.offline.plot with output_type=div and their displayHTML to render plotly in databricks notebooks. This works well inside databricks notebooks in browser env but will not working if we want to show the same notebook inside vscode notebooks.

The problem here is that when I try to render this outputs in vscode notebook out cell directly, the plotly.js can't set up window.Plotly correctly due security mode of vscode, then I got an error in vscode said: Uncaught ReferenceError: Plotly is not defined.

I am using https://marketplace.visualstudio.com/items?itemName=paiqo.databricks-vscode to render and connect notebook inside vscode with databricks. I have a hack hot fix to that extension and add any html that include Plotly.newPlot into an iframe. So I can confirm add the outputs generated by plotly.offline.plot with output_type='div' inside iframe will solve the security issue of vscode and render plotly correctly on both databricks and vscode.

Consider plotly already have IFrameRender, I think we should also add iframe as support type of plotly.offline.plot, generate the source code and put it inside iframe's srcdoc. This way plotly offline can create an isolated version of outputs and make sure it renders correctly in restrict envs like vscode.

Thank you! Let's me know if idea works and I am willing to help.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en el punto de entrada plotly.offline.plot y revisa la compatibilidad existente con IFrameRender. Define cómo un tipo de salida iframe debe generar el código fuente para iframe srcdoc, preservando el comportamiento existente de div, y luego valida el renderizado en entornos de notebooks de Databricks y VSCode.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
jupyter-notebook, python, vscode
Área
data-visualization
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.