當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。