在 MS Access 365 上循环 MS Modern Chart 的 ChartSeriesCollection

问题描述

在旧的 MS Chart 上,我曾经能够使用以下代码更改系列集合的 Point Interior 颜色。

Private Sub Form_Load()
Dim j As Integer
Dim i As Integer
With Me.oldGraph
For j = 1 To .SeriesCollection(1).Points.Count
     .SeriesCollection(1).Points(j).Interior.Color = 65280
     .SeriesCollection(2).Points(j).Interior.Color = 10053222
     
If CDbl(.SeriesCollection(1).Points(j).DataLabel.Text) > CDbl(.SeriesCollection(2).Points(j).DataLabel.Text) Then
     .SeriesCollection(1).Points(j).Interior.Color = RGB(250,0)
Else
     .SeriesCollection(1).Points(j).Interior.Color = 65280
End If
Next j
Me.oldGraph.Requery
End With
End Sub

结果是这样的:

enter image description here

但是在新的 MS Modern Chart 上,.Points.DataLabel 方法似乎不存在。有人遇到过他们还是他们变成了别的东西? 我想根据 FillColor 更改 ChartSeriesCollectionDataLabel。 我正在为 If CDbl(.SeriesCollection(1).Points(j).DataLabel.Text) > CDbl(.SeriesCollection(2).Points(j).DataLabel.Text) 寻找等效的 Modern Chart。 这是我目前拥有的 Modern Chart 代码

 With Me.modernGraph
.RowSource = "qryDonationAndAllocation"
.ChartAxis = "[DonorArea]"
.ChartValues = "[Allocation];[Donation]"
.ChartSeriesCollection.Item("Allocation").FillColor = RGB(0,255,0)
.ChartSeriesCollection.Item("Allocation").BorderColor = RGB(0,0)
.ChartSeriesCollection.Item("Donation").FillColor = RGB(128,128)
.ChartSeriesCollection.Item("Donation").BorderColor = RGB(0,0)
.ChartSeriesCollection.Item("Allocation").displayDataLabel = True
.ChartSeriesCollection.Item("Donation").displayDataLabel = True
.PrimaryValuesAxisFormat = "£0,000.00"
End With

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)