当前位置: 首页>>代码示例>>Python>>正文


Python pyecharts.Pie方法代码示例

本文整理汇总了Python中pyecharts.Pie方法的典型用法代码示例。如果您正苦于以下问题:Python pyecharts.Pie方法的具体用法?Python pyecharts.Pie怎么用?Python pyecharts.Pie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyecharts的用法示例。


在下文中一共展示了pyecharts.Pie方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_simple_pie

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def create_simple_pie():
    pie = Pie('各类电影中"好片"所占的比例', "数据来着豆瓣", title_pos='center')
    pie.add("", ["剧情", ""], [25, 75], center=[10, 30], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None, )
    pie.add("", ["奇幻", ""], [24, 76], center=[30, 30], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None, legend_pos='left')
    pie.add("", ["爱情", ""], [14, 86], center=[50, 30], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["惊悚", ""], [11, 89], center=[70, 30], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["冒险", ""], [27, 73], center=[90, 30], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["动作", ""], [15, 85], center=[10, 70], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["喜剧", ""], [54, 46], center=[30, 70], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["科幻", ""], [26, 74], center=[50, 70], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["悬疑", ""], [25, 75], center=[70, 70], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None)
    pie.add("", ["犯罪", ""], [28, 72], center=[90, 70], radius=[18, 24],
            label_pos='center', is_label_show=True, label_text_color=None, is_legend_show=True, legend_top="center")
    pie.renderer = 'svg'
    return pie 
开发者ID:kinegratii,项目名称:django-echarts,代码行数:26,代码来源:demo_data.py

示例2: pic

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def pic(data, file):
    all_poet = [i[0] for i in data]
    all_num = [i[1] for i in data]
    pie = Pie(title=file.rstrip('2.txt')+'中的四季', title_pos='center')
    pie.add(
        "",
        all_poet,
        all_num,
        radius=[40, 75],
        label_text_color=None,
        is_label_show=True,
        legend_orient="vertical",
        legend_pos="left",
    )

    pie.render(path=file.rstrip('2.txt')+'中的四季'+'.html') 
开发者ID:ZubinGou,项目名称:AI_Poet_Totoro,代码行数:18,代码来源:诗中的春夏秋冬.py

示例3: analysisSex

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def analysisSex(self):
		title = '微信好友性别比'
		data = {'男': 0, '女': 0, '保密': 0}
		pie = Pie(title, title_pos='center')
		pie.use_theme('westeros')
		for each in self.friends_info.get('sex'):
			if each == 0:
				data['保密'] += 1
			elif each == 1:
				data['男'] += 1
			elif each == 2:
				data['女'] += 1
		attrs = [i for i, j in data.items()]
		values = [j for i, j in data.items()]
		pie.add('', attrs, values, is_label_show=True, legend_orient="vertical", legend_pos="left", radius=[30, 75], rosetype="area")
		pie.render(os.path.join(self.savedir, '%s.html' % title)) 
开发者ID:CharlesPikachu,项目名称:WechatHelper,代码行数:18,代码来源:analysisFriends.py

示例4: pie_chart

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def pie_chart():
    warehouses = db.session.query(func.count(warehouse.warehouse_goods_num),
                                  goods.goods_name).filter(warehouse.warehouse_goods_name == goods.goods_name).group_by(
        warehouse.warehouse_supplier_name
    ).all()
    print(warehouses)
    attr = [i for _, i in warehouses]
    v1 = [j for j, _ in warehouses]
    print(attr)
    print(v1)
    pie = Pie("")

    pie.add("", attr, v1, is_stack=True, is_smooth=True, is_fill=True, rosetype="area", is_label_show=True)
    return pie



# 生成编号 
开发者ID:agamgn,项目名称:flask-Purchase_and_sale,代码行数:20,代码来源:uilt.py

示例5: get_echarts_instance

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def get_echarts_instance(self, *args, **kwargs):
        device_data = models.Device.objects.values('device_type').annotate(count=Count('device_type'))
        device_types, counters = fetch(device_data, 'device_type', 'count')
        pie = Pie("设备分类", page_title='设备分类', width='100%')
        pie.add("设备分类", device_types, counters, is_label_show=True)

        battery_lifes = models.Device.objects.values('name', 'battery_life')
        names, lifes = fetch(battery_lifes, 'name', 'battery_life')
        bar = Bar('设备电量', page_title='设备电量', width='100%')
        bar.add("设备电量", names, lifes)
        page = Page.from_charts(pie, bar)
        return page 
开发者ID:kinegratii,项目名称:django-echarts,代码行数:14,代码来源:backend_views.py

示例6: plot_chart

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def plot_chart(counter, chart_type='Bar'):
    items = [item[0] for item in counter]
    values = [item[1] for item in counter]

    if chart_type == 'Bar':
        chart = Bar('微博动态词频统计')
        chart.add('词频', items, values, is_more_utils=True)
    else:
        chart = Pie('微博动态词频统计')
        chart.add('词频', items, values, is_label_show=True, is_more_utils=True)

    chart.render('weibo_wordfrq.html')

#画出微博发布时间的统计图 
开发者ID:starFalll,项目名称:Spider,代码行数:16,代码来源:Data_analysis.py

示例7: alarm_report

# 需要导入模块: import pyecharts [as 别名]
# 或者: from pyecharts import Pie [as 别名]
def alarm_report():
    try:
        INFOS = []
        total_key = 'op_totals_alarms_tmp'
        def counts_alarm(key,total_key = None):
            vals = []
            for i in range(7):
                count_key = 'op_counts_alarms_tmp'
                data_now = datetime.datetime.now() - datetime.timedelta(days=i)
                dd = data_now.strftime('%Y-%m-%d')
                alarm_count_key = '%s_%s' %(key,dd)
                if RC_CLUSTER.exists(alarm_count_key):
                    vals = RC_CLUSTER.hgetall(alarm_count_key)
                    vals = sorted(vals.items(), key=lambda item: int(item[1]))
                    for val in vals:
                        RC_CLUSTER.hincrby(count_key,val[0],val[1])
                        if total_key:
                            RC_CLUSTER.hincrby(total_key,dd, val[1])
            if RC_CLUSTER.exists(count_key):
                vals = RC_CLUSTER.hgetall(count_key)
                RC_CLUSTER.delete(count_key)
                vals = sorted(vals.items(), key=lambda item: int(item[1]),reverse=True)
            if len(vals) >10:
                return vals[:10]
            else:
                return vals
        alarm_count = counts_alarm('op_business_alarm_count',total_key=total_key)
        vals = counts_alarm('op_business_alarm_perf')
        if vals:
            pie_perf = Pie("近7天报警接口性能统计TOP10", width='100%', height='100%', title_pos='center', title_text_size=14)
            attrs = [val[0] for val in vals]
            vals = [int(val[1]) for val in vals]
            pie_perf.add("", attrs, vals, is_label_show=True, is_toolbox_show=False,legend_orient='vertical',legend_pos='left', xaxis_interval=0, is_random=True,rosetype = 'area')
            INFOS.append(pie_perf)
        vals = counts_alarm('op_business_alarm_busi')
        if vals:
            pie_busi = Pie("近7天报警业务归属统计TOP10", width='100%', height='100%', title_pos='center', title_text_size=14)
            attrs = [val[0] for val in vals]
            vals = [int(val[1]) for val in vals]
            pie_busi.add("", attrs, vals, is_label_show=True, is_toolbox_show=False,legend_orient='vertical',legend_pos='left',xaxis_interval=0, is_random=True,rosetype = 'radius',radius=[35, 75])
            INFOS.append(pie_busi)
        if RC_CLUSTER.exists(total_key):
            vals = RC_CLUSTER.hgetall(total_key)
            vals = sorted(vals.items(), key=lambda item: item[0],reverse=True)
            RC_CLUSTER.delete(total_key)
            line = Line("近7天业务接口每日报警统计", width='100%', height='100%', title_pos='center', title_text_size=14)
            attrs = [val[0] for val in vals]
            vals = [int(val[1]) for val in vals]
            line.add("", attrs, vals, is_label_show=True, is_toolbox_show=False,is_legend_show  = False, xaxis_interval=0, is_random=True)
            INFOS.append(line)
    except Exception as e:
        logging.error(e)
        return redirect(url_for('error'))
    return render_template('alarm_report.html',INFOS=INFOS,alarm_count=alarm_count) 
开发者ID:wylok,项目名称:sparrow,代码行数:56,代码来源:report.py


注:本文中的pyecharts.Pie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。