在使用openpyxl绘制折线图的时候,
- 想将折线图的数据标签(DataLabelList)的颜色,数据标签的位置等格式,要怎么设置?
- 想将折线图的趋势线(Trendline)的线型改成点状,颜色改成红色等格式要怎么设置?
```python
from openpyxl import load_workbook
from openpyxl.chart import LineChart, Reference
from openpyxl.chart.label import DataLabelList
from openpyxl.chart.text import RichText
from openpyxl.chart.trendline import Trendline
from openpyxl.drawing.text import RichTextProperties
from openpyxl.styles import Font, Border, Side, Alignment
lc = LineChart()
lc.title = "上周美元走势图"
lc.style = 13
data = Reference(ws,min_col=1,min_row=2,max_col=6,max_row=2)
line_data = Reference(ws,min_col=2,min_row=1,max_col=6,max_row=1)
lc.add_data(data,from_rows=True,titles_from_data=True)
lc.set_categories(line_data)
line1 = lc.series[0]
line1.graphicalProperties.line.width = 20000
line1.dLbls = DataLabelList()
line1.dLbls.showVal = True #显示数据标签
line1.trendline = Trendline() #显示趋势线
lc.legend = None #隐藏图例