Skip to content
本页内容

Legend (属性)

返回一个 Legend 对象,该对象表示指定图表的图例。只读。

示例

python
#本示例显示图表工作表 Chart1 的图例,然后将图例的字体颜色设为蓝色
def test():
    chart = Application.Charts.Item("Chart1").ChartObjects(1).Chart
    chart.HasLegend = True
    chart.Legend.Font.ColorIndex = 5
python
#本示例判断如果第一张工作表第一个嵌入式图表的图例可见,则将图例字体大小设为12
def test():
    chart = Application.Sheets.Item(1).ChartObjects(1).Chart
    if chart.HasLegend:
        chart.Legend.Font.Size = 12