Skip to content

Commit c25f3e6

Browse files
authored
chore: update example (#6)
1 parent 392b8a9 commit c25f3e6

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed

example/app.py

+45-36
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"""
1313

1414
"""
15-
----
1615
## Bar Chart
1716
"""
1817

@@ -36,7 +35,8 @@
3635

3736
g2(options=options)
3837

39-
"""
38+
source = st.expander("Source Code")
39+
source.markdown("""
4040
```py
4141
import streamlit as st
4242
from streamlit_g2 import g2
@@ -61,10 +61,11 @@
6161
6262
g2(options=options)
6363
```
64-
"""
64+
""")
65+
66+
6567

6668
"""
67-
----
6869
## Column Chart
6970
"""
7071

@@ -93,7 +94,8 @@
9394

9495
g2(options=options)
9596

96-
"""
97+
source = st.expander("Source Code")
98+
source.markdown("""
9799
```py
98100
import streamlit as st
99101
from streamlit_g2 import g2
@@ -123,11 +125,11 @@
123125
124126
g2(options=options)
125127
```
126-
"""
128+
""")
129+
127130

128131

129132
"""
130-
----
131133
## Line Chart
132134
"""
133135

@@ -147,7 +149,8 @@
147149

148150
g2(options=options)
149151

150-
"""
152+
source = st.expander("Source Code")
153+
source.markdown("""
151154
```py
152155
import streamlit as st
153156
from streamlit_g2 import g2
@@ -168,11 +171,11 @@
168171
169172
g2(options=options)
170173
```
171-
"""
174+
""")
175+
172176

173177

174178
"""
175-
----
176179
## Area Chart
177180
"""
178181

@@ -192,7 +195,8 @@
192195

193196
g2(options=options)
194197

195-
"""
198+
source = st.expander("Source Code")
199+
source.markdown("""
196200
```py
197201
import streamlit as st
198202
from streamlit_g2 import g2
@@ -213,15 +217,17 @@
213217
214218
g2(options=options)
215219
```
216-
"""
220+
""")
221+
217222

218223

219224
"""
220-
----
221225
## Pie Chart
222226
"""
223227

224228
options = {
229+
"autoFit": True,
230+
"theme": "dark",
225231
"type": "interval",
226232
"coordinate": {
227233
"type": "theta"
@@ -262,7 +268,8 @@
262268

263269
g2(options=options)
264270

265-
"""
271+
source = st.expander("Source Code")
272+
source.markdown("""
266273
```py
267274
import streamlit as st
268275
from streamlit_g2 import g2
@@ -308,12 +315,11 @@
308315
309316
g2(options=options)
310317
```
311-
"""
318+
""")
312319

313320

314321

315322
"""
316-
----
317323
## DualAxes Chart
318324
"""
319325

@@ -475,7 +481,8 @@
475481

476482
g2(options=options)
477483

478-
"""
484+
source = st.expander("Source Code")
485+
source.markdown("""
479486
```py
480487
import streamlit as st
481488
from streamlit_g2 import g2
@@ -638,11 +645,11 @@
638645
639646
g2(options=options)
640647
```
641-
"""
648+
""")
649+
642650

643651

644652
"""
645-
----
646653
## Scatter Chart
647654
"""
648655

@@ -664,7 +671,8 @@
664671

665672
g2(options=options)
666673

667-
"""
674+
source = st.expander("Source Code")
675+
source.markdown("""
668676
```py
669677
import streamlit as st
670678
from streamlit_g2 import g2
@@ -687,12 +695,11 @@
687695
688696
g2(options=options)
689697
```
690-
"""
698+
""")
691699

692700

693701

694702
"""
695-
----
696703
## Liquid Chart
697704
"""
698705

@@ -712,7 +719,8 @@
712719

713720
g2(options=options)
714721

715-
"""
722+
source = st.expander("Source Code")
723+
source.markdown("""
716724
```py
717725
import streamlit as st
718726
from streamlit_g2 import g2
@@ -733,12 +741,11 @@
733741
734742
g2(options=options)
735743
```
736-
"""
744+
""")
737745

738746

739747

740748
"""
741-
----
742749
## Ring Chart
743750
"""
744751

@@ -810,7 +817,8 @@
810817

811818
g2(options=options)
812819

813-
"""
820+
source = st.expander("Source Code")
821+
source.markdown("""
814822
```py
815823
import streamlit as st
816824
from streamlit_g2 import g2
@@ -883,11 +891,11 @@
883891
884892
g2(options=options)
885893
```
886-
"""
894+
""")
895+
887896

888897

889898
"""
890-
----
891899
## Boxplot
892900
"""
893901

@@ -914,7 +922,8 @@
914922

915923
g2(options=options)
916924

917-
"""
925+
source = st.expander("Source Code")
926+
source.markdown("""
918927
```py
919928
import streamlit as st
920929
from streamlit_g2 import g2
@@ -942,12 +951,11 @@
942951
943952
g2(options=options)
944953
```
945-
"""
954+
""")
946955

947956

948957

949958
"""
950-
----
951959
## Funnel Chart
952960
"""
953961

@@ -1002,7 +1010,8 @@
10021010

10031011
g2(options=options)
10041012

1005-
"""
1013+
source = st.expander("Source Code")
1014+
source.markdown("""
10061015
```py
10071016
import streamlit as st
10081017
from streamlit_g2 import g2
@@ -1058,12 +1067,11 @@
10581067
10591068
g2(options=options)
10601069
```
1061-
"""
1070+
""")
10621071

10631072

10641073

10651074
"""
1066-
----
10671075
## Histogram
10681076
"""
10691077

@@ -1096,7 +1104,8 @@
10961104

10971105
g2(options=options)
10981106

1099-
"""
1107+
source = st.expander("Source Code")
1108+
source.markdown("""
11001109
```py
11011110
import streamlit as st
11021111
from streamlit_g2 import g2
@@ -1130,4 +1139,4 @@
11301139
11311140
g2(options=options)
11321141
```
1133-
"""
1142+
""")

streamlit_g2/frontend/src/g2.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect } from 'react';
1+
import React from 'react';
22
import {
33
Streamlit,
44
withStreamlitConnection,

0 commit comments

Comments
 (0)