是否有一种聪明的方法可以将标签显示在标记上方,标记下方的下一个点等等:
(62.2% above, 71.6% below, 77.3% above, 84.9% below...)
我知道我可以手动放置每个标签,但我会自动搜索它。
也许有某种设置/公式/ VBA宏?
答案 0 :(得分:1)
运行此宏:
Public Sub alternateLabels()
Dim ch As Chart
Dim lab As DataLabel
Dim s As Series
Dim count As Integer
' use the appropriate names for the objects and worksheets here
Set ch = ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart 1").Chart
' this should be the "cumulative" series, check with msgbox, and remove msgbox line if it's ok
Set s = ch.SeriesCollection(2)
MsgBox s.Name 'remove this line as needed
For Each lab In s.DataLabels
If count Mod 2 = 0 Then
lab.Position = xlLabelPositionAbove
Else
lab.Position = xlLabelPositionBelow
End If
count = count + 1
Next lab
End Sub