Skip to content

Commit

Permalink
Refactor basic usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Feb 20, 2024
1 parent 601eb5d commit ec2f422
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ from pandas import DataFrame

# Must always be imported, otherwise App is not found
from shiny.express import ui
from shinyecharts import Chart, ChartRenderer, InitOptions

init_options = InitOptions(width=600, height=400)
from shinyecharts import Chart, ChartRenderer

data = DataFrame(
[[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]],
Expand All @@ -39,9 +37,10 @@ data = DataFrame(


@ChartRenderer
def render_dataset():
def render_line_chart():
return (
Chart(data, init_options)
Chart(data)
.configure(width=800, height=600)
.encode("a", "b")
.encode("a", "c")
.encode("a", "d")
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/getting_started/basic_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

# Must always be imported, otherwise App is not found
from shiny.express import ui
from shinyecharts import Chart, ChartRenderer, InitOptions

init_options = InitOptions(width=600, height=400, renderer="canvas")
from shinyecharts import Chart, ChartRenderer

data = DataFrame(
[[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]],
Expand All @@ -13,9 +11,10 @@


@ChartRenderer
def render_dataset():
def render_line_chart():
return (
Chart(data, init_options)
Chart(data)
.configure(width=800, height=600)
.encode("a", "b")
.encode("a", "c")
.encode("a", "d")
Expand Down

0 comments on commit ec2f422

Please sign in to comment.