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 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

plotly.offline.plot のエントリーポイントから開始し、既存の IFrameRender サポートを確認します。既存の div の動作を維持しながら、iframe 出力タイプが iframe srcdoc 用のソースをどのように生成すべきかを定義し、その後 Databricks および VSCode のノートブック環境でレンダリングを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
jupyter-notebook, python, vscode
領域
data-visualization
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。