展示2021年风车车萌宠营业部经营情况。
二、代码#!/usr/bin/env python
# -*- coding: utf-8 -*-
# time : 2022/2/24 0024
#导入pyecharts相关库和random库
import random
from pyecharts import options as opts
from pyecharts.charts import Bar, Gauge, Pie, Page, Funnel, Geo, Scatter3D
#根据月份汇总,横坐标为月份,纵坐标为订单数和完成数,数据为随机数
def bar(): # 柱状图
cate = ['1月', '2月', '3月', '4月', '5月', '6月','7月','8月','9月','10月','11月','12月']
c = (
Bar()
.add_xaxis(cate)
.add_yaxis("月订单数", [random.randint(100, 200) for _ in cate])
.add_yaxis("月完成数", [random.randint(50, 100) for _ in cate])
.set_series_opts(
label_opts=opts.LabelOpts(is_show=True, color="black")
)
.set_global_opts(title_opts=opt


