A
ash
Hi,
I am trying to loop through each series of a bubble chart, turn on the
datalabels for that series, and then get a reference to the first datalabel.
This code is in .net.
When I do this, on the first pass of the loop I get a reference to datalabel
1 of the first series fine, however it does not work for any other series.
My code is below...I can't figure out why it works for series 1 but not
after that.
Dim seriescol As Graph.SeriesCollection=nothing
Dim series As Graph.Series=nothing
Dim datalbls As Graph.DataLabels=nothing
Dim datalbl As Graph.DataLabel=nothing
Try
seriescol = CType(cht.SeriesCollection, Graph.SeriesCollection)
'loop through each series
For i = 1 To seriescol.Count
series = CType(seriescol.Item(i), Graph.Series)
If series.HasDataLabels = False Then
series.ApplyDataLabels (Graph.XlDataLabelsType.xlDataLabelsShowLabel)
datalbls = CType(series.DataLabels, Graph.DataLabels)
datalbls.ShowSeriesName = True
datalbl = CType(datalbls.Item(1), Graph.DataLabel)
Messagebox.Show(datalbl.Text) ‘ERROR HERE
Next i
I am trying to loop through each series of a bubble chart, turn on the
datalabels for that series, and then get a reference to the first datalabel.
This code is in .net.
When I do this, on the first pass of the loop I get a reference to datalabel
1 of the first series fine, however it does not work for any other series.
My code is below...I can't figure out why it works for series 1 but not
after that.
Dim seriescol As Graph.SeriesCollection=nothing
Dim series As Graph.Series=nothing
Dim datalbls As Graph.DataLabels=nothing
Dim datalbl As Graph.DataLabel=nothing
Try
seriescol = CType(cht.SeriesCollection, Graph.SeriesCollection)
'loop through each series
For i = 1 To seriescol.Count
series = CType(seriescol.Item(i), Graph.Series)
If series.HasDataLabels = False Then
series.ApplyDataLabels (Graph.XlDataLabelsType.xlDataLabelsShowLabel)
datalbls = CType(series.DataLabels, Graph.DataLabels)
datalbls.ShowSeriesName = True
datalbl = CType(datalbls.Item(1), Graph.DataLabel)
Messagebox.Show(datalbl.Text) ‘ERROR HERE
Next i