-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update data so that redefine can be called multiple times
- Loading branch information
Stefan Kuethe
committed
Feb 12, 2024
1 parent
8f4c0d7
commit 32e895c
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from htmltools import a | ||
from shiny.express import ui | ||
from shinyobservable import Observable, ObservableRenderer | ||
|
||
# NOTEBOOK = "https://observablehq.com/@d3/zoomable-sunburst" | ||
NOTEBOOK = "https://observablehq.com/@eoda/test" | ||
|
||
ui.h1("Observable Notebook in Shiny") | ||
ui.div(a(NOTEBOOK, href=NOTEBOOK, target="_blank")) | ||
ui.hr() | ||
|
||
|
||
# Embed selected cells | ||
@ObservableRenderer | ||
def render_cells(): | ||
return Observable(NOTEBOOK, cells=[2, 3, 4]) | ||
|
||
|
||
# Include entire notebook | ||
# @ObservableRenderer | ||
def render_notebook(): | ||
return Observable(NOTEBOOK) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from htmltools import a | ||
from shiny.express import ui | ||
from shinyobservable import Observable, ObservableRenderer | ||
|
||
NOTEBOOK = "https://observablehq.com/@eoda/playground" | ||
|
||
ui.h1("Observable Notebook in Shiny") | ||
ui.div(a(NOTEBOOK, href=NOTEBOOK, target="_blank")) | ||
ui.hr() | ||
|
||
|
||
# Embed selected cells | ||
@ObservableRenderer | ||
def render_cells(): | ||
return ( | ||
Observable(NOTEBOOK, cells=["viewof echart", "echart"]) | ||
.redefine( | ||
chartData=dict(x=["A", "B", "C", "D", "E"], y=[100, 150, 120, 40, 80]) | ||
) | ||
.redefine(lineColor="green") | ||
) | ||
|
||
|
||
# Include entire notebook | ||
# @ObservableRenderer | ||
def render_notebook(): | ||
return Observable(NOTEBOOK) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters