MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / pyecharts

Function pyecharts

test/11.charts.py:183–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181
182
183def pyecharts():
184 from pyecharts.charts import Bar
185 from pyecharts.faker import Faker
186 from pyecharts import options as opts
187 from pyecharts.charts import Polar
188 from pyecharts.charts import HeatMap
189 from pyecharts.charts import Tree
190 from pyecharts.globals import CurrentConfig
191
192 CurrentConfig.ONLINE_HOST = "https://cdn.jsdelivr.net/gh/pyecharts/pyecharts-assets@master/assets/"
193
194 r1 = ['草莓', '芒果', '葡萄', '雪梨', '西瓜', '柠檬', '车厘子']
195 r2 = [127, 33, 110, 29, 146, 121, 36]
196 r3 = [25, 87, 114, 131, 130, 94, 146]
197 c1 = (
198 Bar({"width": "100%"})
199 .add_xaxis(r1)
200 .add_yaxis("商家A", r2)
201 .add_yaxis("商家B", r3)
202 .set_global_opts(title_opts=opts.TitleOpts(title="Bar-基本示例", subtitle="我是副标题"))
203 )
204
205 c2 = (
206 Polar({"width": "100%"})
207 .add_schema(
208 radiusaxis_opts=opts.RadiusAxisOpts(data=Faker.week, type_="category"),
209 angleaxis_opts=opts.AngleAxisOpts(is_clockwise=True, max_=10),
210 )
211 .add("A", [1, 2, 3, 4, 3, 5, 1], type_="bar")
212 .set_global_opts(title_opts=opts.TitleOpts(title="Polar-RadiusAxis"))
213 .set_series_opts(label_opts=opts.LabelOpts(is_show=True))
214
215 )
216
217 data = [
218 {
219 "children": [
220 {"name": "B"},
221 {
222 "children": [{"children": [{"name": "I"}], "name": "E"}, {"name": "F"}],
223 "name": "C",
224 },
225 {
226 "children": [
227 {"children": [{"name": "J"}, {"name": "K"}], "name": "G"},
228 {"name": "H"},
229 ],
230 "name": "D",
231 },
232 ],
233 "name": "A",
234 }
235 ]
236
237 c3 = (
238 Tree({"width": "100%"})
239 .add("", data)
240 .set_global_opts(title_opts=opts.TitleOpts(title="Tree-基本示例"))

Callers 1

targetFunction · 0.85

Calls 2

put_gridFunction · 0.85
put_htmlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…