Skip to content
本页内容

ShowLegendKey (属性)

如果数据标签图例项标示可见,则为 Truebool 类型,可读写。

示例

python
#此示例设置 Chart1 中系列一的第三个数据标签,以显示数值和图例标示
def test():
    datalabel = Application.Charts.Item("Chart1").ChartObjects(1).Chart.SeriesCollection(1).DataLabels(3)
    datalabel.ShowLegendKey = True
    datalabel.ShowValue = True
python
#此示例判断工作表 Sheet1 中第一张图表的第二个系列的第三个数据标签的图例项标示是否可见,并通知用户
def test():
    datalabel = Application.Sheets.Item("Sheet1").ChartObjects(1).Chart.SeriesCollection(2).DataLabels(3)
    if datalabel.ShowLegendKey:
        print("数据标签的图例项标示可见")
    else:
        print("数据标签的图例项标示不可见")