mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
Add Plotly output support to notebooks
With this change, Plotly types will be successfully rendered in a Notebook. Currently they have a default width of 700px with a scrollbar if the window size is smaller (this matches other notebook viewers). The Plotly library is dynamically required to avoid startup time perf hits. This is something we could look at for other components too.
This commit is contained in:
@@ -19,6 +19,7 @@ import product from 'vs/platform/product/node/product';
|
||||
import { registerComponentType } from 'sql/workbench/parts/notebook/outputs/mimeRegistry';
|
||||
import { MimeRendererComponent as MimeRendererComponent } from 'sql/workbench/parts/notebook/outputs/mimeRenderer.component';
|
||||
import { MarkdownOutputComponent } from 'sql/workbench/parts/notebook/outputs/markdownOutput.component';
|
||||
import { PlotlyOutputComponent } from 'sql/workbench/parts/notebook/outputs/plotlyOutput.component';
|
||||
|
||||
// Model View editor registration
|
||||
const viewModelEditorDescriptor = new EditorDescriptor(
|
||||
@@ -138,7 +139,6 @@ registerComponentType({
|
||||
|
||||
/**
|
||||
* A mime renderer component for LaTeX.
|
||||
* This will be replaced by a dedicated component in the future
|
||||
*/
|
||||
registerComponentType({
|
||||
mimeTypes: ['text/latex'],
|
||||
@@ -150,7 +150,6 @@ registerComponentType({
|
||||
|
||||
/**
|
||||
* A mime renderer component for Markdown.
|
||||
* This will be replaced by a dedicated component in the future
|
||||
*/
|
||||
registerComponentType({
|
||||
mimeTypes: ['text/markdown'],
|
||||
@@ -159,3 +158,26 @@ registerComponentType({
|
||||
ctor: MarkdownOutputComponent,
|
||||
selector: MarkdownOutputComponent.SELECTOR
|
||||
});
|
||||
|
||||
/**
|
||||
* A mime renderer component for Plotly graphs.
|
||||
*/
|
||||
registerComponentType({
|
||||
mimeTypes: ['application/vnd.plotly.v1+json'],
|
||||
rank: 45,
|
||||
safe: true,
|
||||
ctor: PlotlyOutputComponent,
|
||||
selector: PlotlyOutputComponent.SELECTOR
|
||||
});
|
||||
/**
|
||||
* A mime renderer component for Plotly HTML output
|
||||
* that will ensure this gets ignored if possible since it's only output
|
||||
* on offline init and adds a <script> tag which does what we've done (add Plotly support into the app)
|
||||
*/
|
||||
registerComponentType({
|
||||
mimeTypes: ['text/vnd.plotly.v1+html'],
|
||||
rank: 46,
|
||||
safe: true,
|
||||
ctor: PlotlyOutputComponent,
|
||||
selector: PlotlyOutputComponent.SELECTOR
|
||||
});
|
||||
Reference in New Issue
Block a user