Bonjour,

Voila je cherche à faire un graph à deux axes pour deux séries en ligne avec les OWC11 en VB à partir de données excel.

Voici mon code pour 1 axe mais je n'arrive pas à en ajouter un deuxième

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
86
87
88
89
90
 
 
Set c = ChartSpace1.Constants
Set Cht = ChartSpace1.Charts.Add
 
For i = 1 To njour
    tableau(i) = CInt(Format(CDate(Wsheet5.Cells(lignedébut + i - 1, 1)), "dd")) 'Abscisses
Next i
 
If Cht.SeriesCollection.Count > 0 Then Cht.SeriesCollection.Add
    For i = 1 To njour - 1
        app = Wsheet5.Cells(lignedébut + i - 1, 15)
        rejet = Wsheet5.Cells(lignedébut + i - 1, 16)
        Plage(i) = ((rejet / app) * 100)
            If Plage(i) <> "" Then
            End If
    Next i
    Cht.SetData c.chDimCategories, c.chDataLiteral, tableau
    Cht.SeriesCollection(x).SetData c.chDimValues, c.chDataLiteral, Plage
    x = x + 1
    Erase Plage
 
moy = (moy / njour)
 
'série 2
 
ReDim Plage(njour)
 
If Cht.SeriesCollection.Count > 0 Then Cht.SeriesCollection.Add
    For i = 1 To njour
        Plage(i) = Wsheet5.Cells(lignedébut + i - 1, 15)
    Next i
    Cht.SetData c.chDimCategories, c.chDataLiteral, tableau
    Cht.SeriesCollection(x).SetData c.chDimValues, c.chDataLiteral, Plage
    x = x + 1
    Erase Plage
 
Set chscal = Cht.Axes(c.chAxisPositionleft).Scaling
 
With Cht
    .Axes.Add (chscal)
    .SeriesCollection(1).Type = chChartTypeLine
    .SeriesCollection(0).Type = chChartTypeLine
    .HasTitle = True
    .Title.Caption = "Pourcentage d'appels perdus - " & mois & " " & calendarJ1.Year
    .HasLegend = True
    .Legend.Position = chLegendPositionBottom
    .Legend.Font.Color = "white"
    .Legend.Font.Bold = True
    .Legend.Interior.Color = "black"
    .Legend.Border.Color = "white"
    .Axes(xlCategory).HasMajorGridlines = False
    .Axes(0).Font.Color = "white"
    .Axes(0).Line.Color = "white"
    .Axes(xlCategory).Font.Color = "white"
    .Axes(xlCategory).Line.Color = "white"
End With
 
With Cht.Title.Font     'titre
    .Bold = True
    .Size = "14"
    .Color = "white"
End With
 
Cht.Interior.SetOneColorGradient c.chGradientHorizontal, c.chGradientVariantCenter, 0.8, _
    RGB(0, 0, 0)
Cht.PlotArea.Interior.SetOneColorGradient c.chGradientHorizontal, c.chGradientVariantEdges, 0.8, _
    RGB(0, 0, 0)
Cht.SeriesCollection(0).Interior.SetTwoColorGradient c.chGradientFromCenter, c.chGradientVariantEnd, _
    RGB(0, 0, 128), RGB(128, 255, 255)
'config format séries
 
With Cht.SeriesCollection(0)
    .Caption = "nb appels/heures"
    .DataLabelsCollection.Add
End With
 
With Cht.SeriesCollection(1)
    .Caption = ""
    .Marker.Size = 0
    .Line.Weight = 0
End With
 
With Cht.SeriesCollection(0).DataLabelsCollection(0)            'etiquettes
    .NumberFormat = "0"
'    .Position = chLabelPositionOutsideEnd
    .Font.Bold = True
    .Font.Color = "white"
End With
End Sub
ce code ajoute un deuxième axe mais à gauche là où il y a déjà le premier axe

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
 
Set chscal = Cht.Axes(c.chAxisPositionleft).Scaling
 
Cht.Axes.Add (chscal)
mais si je change chAxisPositionleft en chAxisPositionright, j'ai un erreur.

Si kk'un à la solution ?

Merci d'avance