小白学Python(17)——pyecharts 日历图 Calendar

Calendar-2017年微信步数情况

 

 1 import datetime
 2 import random
 3 
 4 from pyecharts import options as opts
 5 from pyecharts.charts import Calendar
 6 
 7 begin = datetime.date(2017, 1, 1)
 8 end = datetime.date(2017, 12, 31)
 9 data = [
10         [str(begin + datetime.timedelta(days=i)), random.randint(1000, 25000)]
11         for i in range((end - begin).days + 1)
12     ]
13 
14 calendar=(
15         Calendar()
16         .add("", data, calendar_opts=opts.CalendarOpts(range_="2017"))
17         .set_global_opts(
18             title_opts=opts.TitleOpts(title="Calendar-2017年微信步数情况"),
19             visualmap_opts=opts.VisualMapOpts(
20                 max_=20000,
21                 min_=500,
22                 orient="horizontal",
23                 is_piecewise=True,
24                 pos_top="230px",
25                 pos_left="100px",
26             ),
27         )
28     )
29 
30 calendar.render()

小白学Python(17)——pyecharts 日历图 Calendar_第1张图片

 

转载于:https://www.cnblogs.com/adam012019/p/11402678.html

你可能感兴趣的:(小白学Python(17)——pyecharts 日历图 Calendar)