Skip to content
本页内容

HasLegend (属性)

如果图表有图例,则该属性值为 Truebool 类型,可读写。

示例

python
#本示例显示图表工作表 Chart1 的图例,然后将图例的字体颜色设为蓝色
def test():
    chart = Application.Charts.Item("Chart1").ChartObjects(1).Chart
    chart.HasLegend = True
    chart.Legend.Font.ColorIndex = 5
python
#本示例显示活动工作表第一个嵌入式图表是否有图例
def test():
    chart = Application.ActiveSheet.ChartObjects(1).Chart
    print(chart.HasLegend)