问题 我想使用openpyxl来更改图表的标题。然而,当我去搜索它的时候,无论是StackOverflow还是谷歌,大多数时候,人们想要改变轴的标题。但我对改变图表标题本身很感兴趣。请不要关闭我的代码,因为它的大部分只是我的造型图和显示数据雪花图。
chart = LineChart(auto_axis = False)
chart.height = 15 # default is 7.5
chart.width = 30 # default is 15
# Setting the title and style
titleStr = "IB Issues (" + str(bussinessMonth[0]) + " - " + str(businessMonth[6]) + ")" + "\nSource: IE"
chart.title = titleStr
chart.style = 11
# Adding the data
data = Reference(summaryWS, min_col=2, max_col= summaryWS.max_column, min_row=3, max_row = 4)
chart.add_data(data, titles_from_data=True, from_rows=True )
Date = Reference(summaryWS, min_col=3, max_col= summaryWS.max_column , min_row = 2 )
chart.set_categories(Date)
# Styling of lines
s1 = chart.series[0]
s1.smooth = False # Make the line smooth
# Initialise data labels
s1.dLbls = DataLabelList()
s1.dLbls.dLblPos = "t"
s1.dLbls.showVal = True
# Styling of lines
s2 = chart.series[1]
s2.graphicalProperties.line.solidFill = "ED7D31"
s2.graphicalProperties.line.dashStyle = "sysDot"
s2.smooth = False # Make the line smooth
# Initialise data labels
s2.dLbls = DataLabelList()
dl = DataLabel()
dl.showVal = True
dl.showSerName = True
dl.position = "t"
s2.dLbls.dLbl.append(dl)
summaryWS.add_chart(chart, "B10")
问题 谢谢。 问题来源StackOverflow 地址:/questions/59384849/edit-the-font-size-of-the-chart-title-using-openpyxl
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。