-
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.
- Loading branch information
Stefan Kuethe
committed
Feb 9, 2024
1 parent
e92fd74
commit 499f417
Showing
2 changed files
with
14 additions
and
22 deletions.
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
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 |
---|---|---|
@@ -1,30 +1,26 @@ | ||
from echarts4py.chart import Chart, InitOptions | ||
from echarts4py.option import ChartOption | ||
from echarts4py.options import Line | ||
from echarts4py.renderer import ChartRenderer | ||
from pandas import DataFrame | ||
|
||
# Must always be imported, otherwise App is not found | ||
from shiny.express import ui | ||
|
||
options = InitOptions(width=600, height=400, renderer="canvas") | ||
init_options = InitOptions(width=600, height=400, renderer="canvas") | ||
|
||
data = DataFrame( | ||
[[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]], | ||
columns=["a", "b", "c", "d"], | ||
) | ||
|
||
|
||
lines = ChartOption( | ||
tooltip={"trigger": "axis"}, | ||
legend={}, | ||
series=[ | ||
{"name": "L1", "type": "line", "encode": {"x": "a", "y": "b"}}, | ||
{"name": "L2", "type": "line", "encode": {"x": "a", "y": "d"}}, | ||
{"name": "L3", "type": "line", "encode": {"x": 0, "y": "c"}}, | ||
], | ||
lines = ( | ||
Line(x="a", y="b", tooltip=dict(trigger="axis"), legend=dict()) | ||
.add_series("c") | ||
.add_series("d") | ||
) | ||
|
||
|
||
@ChartRenderer | ||
def render_dataset(): | ||
return Chart(options, data=data).set_option(lines) | ||
return Chart(init_options, data=data).set_option(lines) |