plotly / plotly/plotly.py

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

未關閉
#4,552 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

feature P3
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

描述

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.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 plotly.offline.plot 入口點開始,檢視現有的 IFrameRender 支援。定義 iframe 輸出類型應如何為 iframe srcdoc 產生原始碼,同時保留現有的 div 行為,然後在 Databricks 和 VSCode notebook 環境中驗證轉譯。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
jupyter-notebook, python, vscode
領域
data-visualization
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。