月度回报更新

parent b322e2c8
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -30,7 +30,7 @@ def draw_month_return_chart(xlabels, product_list, cumulative): ...@@ -30,7 +30,7 @@ def draw_month_return_chart(xlabels, product_list, cumulative):
# plt.title('Scores by group and gender') # plt.title('Scores by group and gender')
# plt.ylabel('Scores') # plt.ylabel('Scores')
figsize = (20, 12) figsize = (24, 12)
# 标签文字大小 # 标签文字大小
fontsize = 15 fontsize = 15
# 初始化 # 初始化
...@@ -72,11 +72,19 @@ def draw_month_return_chart(xlabels, product_list, cumulative): ...@@ -72,11 +72,19 @@ def draw_month_return_chart(xlabels, product_list, cumulative):
ax = ax1.bar(loc, product_list[i]['data'], width, bottom=bottom, color=color_list[i], alpha=0.8) ax = ax1.bar(loc, product_list[i]['data'], width, bottom=bottom, color=color_list[i], alpha=0.8)
else: else:
ax = ax1.bar(loc, product_list[i]['data'], width, bottom=bottom, alpha=0.8) ax = ax1.bar(loc, product_list[i]['data'], width, bottom=bottom, alpha=0.8)
for a, b in zip(range(len(xlabels)), product_list[0]['data']):
if b > 0:
ax1.text(a, b+0.2, '%.0f万' % b, ha='center', va='bottom', fontsize=fontsize)
elif b < 0:
ax1.text(a, b-0.5, '%.0f万' % b, ha='center', va='top', fontsize=fontsize)
prod_legend.append(ax[0]) prod_legend.append(ax[0])
ax1.legend(prod_legend, [prod['name'] for prod in product_list], loc='upper left', fontsize=fontsize) ax1.legend(prod_legend, [prod['name'] for prod in product_list], loc='upper left', fontsize=fontsize)
# 画折线图 # 画折线图
ax2.plot(loc, cumulative['data'], color='#C6A774', marker='', linewidth=3, label=cumulative['name']) ax2.plot(loc, cumulative['data'], color='#C6A774', marker='', linewidth=3, label=cumulative['name'])
# 添加数字标签
for a, b in zip(range(len(xlabels)), cumulative['data']):
ax2.text(a, b + 0.1, '%.2f' % b + '%', ha='center', va='bottom', fontsize=fontsize)
ax2.legend(loc='upper center', fontsize=fontsize) ax2.legend(loc='upper center', fontsize=fontsize)
# plt.show() # plt.show()
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment