Python之pyecharts

引导:

图表展示库
echarts:前端图表展示库
matplotlib、Seaborn、bokeh、pyecharts:后端图表展示库

1.安装 pyecharts

pip install pyecharts

2. 代码如下

#views.py



from pyecharts import Bar
list1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
list2 = ['3391', '2813', '4450', '4438', '1258', '1824', '2427', '3267', '635', '3771', '1789', '6584', '5845', '1465', '618', '1876', '949', '1876', '5476', '4175', '237', '504', '3339', '2554', '3331', '4078']
bar = Bar("歌手数量", "酷我音乐")
bar.add("歌手", list1, list2, is_more_utils=True)
bar.render(path='./templates/singer_table.html')  # 在指定位置生成 singer_table.html 文件


#settings.py

'DIRS': [os.path.join(BASE_DIR,'singer_table.html')],

3.效果如下

 

猜你喜欢

转载自blog.csdn.net/qq_38661599/article/details/81155449