I'm trying to create a code for generate some graphs with some data already stored in arrays.
The actual final result of the macro is this graph:
The code used for it is the following:
Dim sht As Worksheet
Set sht = ActiveSheet
Dim chtObj As ChartObject
Set chtObj = sht.ChartObjects.Add(100, 10, 500, 300)
Dim cht As Chart
Set cht = chtObj.Chart
If IsZeroLengthArray(yData_TSI) = False Then
Dim ser As Series
Set ser = cht.SeriesCollection.NewSeries
ser.Values = yData_TSI
ser.XValues = xData_TSI
ser.Name = "TSI Predicant"
ser.ChartType = xlXYScatterSmooth
End If
If IsZeroLengthArray(yData_Pallet) = False Then
Dim ser2 As Series
Set ser2 = cht.SeriesCollection.NewSeries
ser2.Values = yData_Pallet
ser2.XValues = xData_Pallet
ser2.Name = "Pallet Decant"
ser2.ChartType = xlXYScatterSmooth
End If
If IsZeroLengthArray(yData_Vendor) = False Then
Dim ser3 As Series
Set ser3 = cht.SeriesCollection.NewSeries
ser3.Values = yData_Vendor
ser3.XValues = xData_Vendor
ser3.Name = "Vendor Decant"
ser3.ChartType = xlXYScatterSmooth
End If
If IsZeroLengthArray(yData_Prep) = False Then
Dim ser4 As Series
Set ser4 = cht.SeriesCollection.NewSeries
ser4.Values = yData_Prep
ser4.XValues = xData_Prep
ser4.Name = "Each"
ser4.ChartType = xlXYScatterSmooth
End If
If IsZeroLengthArray(yData_Each) = False Then
Dim ser5 As Series
Set ser5 = cht.SeriesCollection.NewSeries
ser5.Values = yData_Each
ser5.XValues = xData_Each
ser5.Name = "Prep"
ser5.ChartType = xlXYScatterSmooth
End If
I have in other arrays (tData_XXX) numbers that I would like to add as a label to the bullet points in the graph. To make myself clear, for the same graph generated before, let's imagine than for the "Vendor Decant" data the tData_Vendor array has the numbers (34, 5, 12). The desired result should be something like this:
How can I do this on the code?
Thanks!
Note:
- All the arrays (yData_XXX, xData_XXX and tData_XXX) are always the same size

