1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| ' #######################################################################################
' MISE EN PLACE DU GRAPHIQUE
' #######################################################################################
Dim S1 As Object, S2 As Object, S3 As Object, S4 As Object
Dim TabAbscisses(), TabOrdonnees(), TabOrdonnees1(), TabOrdonnees2(), TabOrdonnees3()
Dim Cht As ChChart
Dim C As Object
ChartSpace4.Clear
ChartSpace4.Refresh
ReDim TabAbscisses(0 To dercol_global - 2)
ReDim TabOrdonnees(0 To dercol_global - 2)
ReDim TabOrdonnees1(0 To dercol_global - 2)
ReDim TabOrdonnees2(0 To dercol_global - 2)
ReDim TabOrdonnees3(0 To dercol_global - 2)
dercol_global = sheets("Indicateurs").Cells(25, Columns.Count).End(xlToLeft).Column ' dernière colonne dans la ligne 6
'Remplissage des tableaux qui serviront à créer le graphique
For i = 0 To dercol_global - 3
TabAbscisses(i) = sheets("Indicateurs").Cells(25, i + 3).Value
TabOrdonnees(i) = sheets("Indicateurs").Cells(29, i + 3).Value
TabOrdonnees1(i) = sheets("Indicateurs").Cells(35, i + 3).value
TabOrdonnees2(i) = sheets("Indicateurs").Cells(31, i + 3).value
TabOrdonnees3(i) = -(sheets("Indicateurs").Cells(33, i + 3).Value)
Next i
Set C = ChartSpace4.Constants
Set Cht = ChartSpace4.Charts.Add
With Cht
'Type de graphique
.Type = C.chChartTypeScatterLineMarkers
.HasLegend = True
.Legend.Position = C.chLegendPositionBottom
End With
Set S4 = Cht.SeriesCollection.Add
With S4
.Caption = "Stock SAPHIR"
.Type = C.chChartTypeLine
.SetData C.chDimCategories, C.chDataLiteral, TabAbscisses
.SetData C.chDimValues, C.chDataLiteral, TabOrdonnees
End With
Set S1 = Cht.SeriesCollection.Add
With S3
.Caption = "Stock BAAN"
.Type = C.chChartTypeLine
.SetData C.chDimCategories, C.chDataLiteral, TabAbscisses
.SetData C.chDimValues, C.chDataLiteral, TabOrdonnees1
End With
Set S2 = Cht.SeriesCollection.Add
With S2
.Caption = "Qté Entrées"
.Type = C.chChartTypeColumnClustered
.SetData C.chDimCategories, C.chDataLiteral, TabAbscisses
.SetData C.chDimValues, C.chDataLiteral, TabOrdonnees2
.Line.Color = RGB(0, 64, 224)
.Ungroup True
End With
Set S1 = Cht.SeriesCollection.Add
With S1
.Caption = "Qté sorties"
.Type = C.chChartTypeColumnClustered
.SetData C.chDimCategories, C.chDataLiteral, TabAbscisses
.SetData C.chDimValues, C.chDataLiteral, TabOrdonnees3
.Line.Color = RGB(255, 0, 0)
.Ungroup True
End With
Dim oAxis2Y
Set oAxis2Y = Cht.Axes.Add(S1.Scalings(chDimValues))
oAxis2Y.Position = chAxisPositionRight
oAxis2Y.HasMajorGridlines = False |
Partager