dessiner graphique dans chartspace owc et l'imprimer !!!

bob3333

XLDnaute Nouveau
Bonjour,

J'ai un probleme de chartspace owc que j'arrive pas a résoudre depuis 3 semaine :(

en faite je veut afficher un graphique a partir de donnée excel,

alors j'ai une colonne "x" fixée et deux autres colonne "y" et "z" , chaque colonne a de 1 à 100 ligne

je veux afficher un graphique qui compare les valeurs de x avec y ou z au choix pour :) et pour les ligne de 1 à 100 au choix :D

alors j'ai bien fait une combobox pour choisir entre y et z (facile :) )
et une listbox a choix multiple pour choisir les lignes entre 1 et 100 :D

Mon probleme se trouve au niveau du graphique, en fait il m'afficher que la premiers ligne que je selectionne de ma list box meme si je prend la totalité des lignes :(

voir l'image :

gTNMb.jpg

Pouvez vous me dire ce qui ne vas pas dans mon code svp

Code:
  Private Sub drow()
                                                                                                     Dim i, k As Integer, x As Integer
          Dim j As Integer
          Dim Table(), Plage(2)
          Dim id As Integer

          id = 1

         Do While ComboBox.Value <> idi(id, 1) 
           id = id + 1
          Loop 

          For i = Cht.SeriesCollection.Count To 1 Step -1
             Cht.SeriesCollection.Delete i - 1
          Next i

              k = 1
           ReDim Table(ListBox.ListCount)

        For i = 0 To ListBox.ListCount - 1 
          If ListBox.Selected(i) = True Then
             Table(k) = ListBox.List(i)
            k = k + 1
          End If
          Next i

    With Cht
    .HasLegend = True
     .Legend.Position = chLegendPositionBottom
         .HasTitle = True
        .Title.Caption = ComboBox.Text
       End With

  Cht.Type = C.chChartTypeColumnClustered3D

    With Cht
        'first serie
        .SeriesCollection.Add
        .SeriesCollection(0).Caption = sheet.Cells(2, 15 + id) 
        .SeriesCollection(0).DataLabelsCollection.Add
        .SeriesCollection(0).DataLabelsCollection(0).Position = chLabelPositionCenter
        .SeriesCollection(0).DataLabelsCollection(0).Font.Color = RGB(255, 255, 255)

        .SeriesCollection.Add
        .SeriesCollection(1).Caption = sheet.Cells(2, 20)      .SeriesCollection(1).DataLabelsCollection.Add
        .SeriesCollection(1).DataLabelsCollection(0).Position = chLabelPositionCenter
        .SeriesCollection(1).DataLabelsCollection(0).Font.Color = RGB(255, 255, 255)

        .SetData C1.chDimCategories, C1.chDataLiteral, Table

        End With

   For j = 0 To ListBox.ListCount - 1
    If ListBox.Selected(j) = True Then

     Plage(1) = sheet.Cells(j + 3, 15 + id) 'the Xs
     Plage(2) = sheet.Cells(j + 3, 20) 'Les 'the Ys

      With Cht

        .SeriesCollection(0).SetData C1.chDimValues, C1.chDataLiteral, Plage(1)
        .SeriesCollection(1).SetData C1.chDimValues, C1.chDataLiteral, Plage(2)


      End With
    Erase Plage
   End If
  Next j

  End Sub

Merci d'avance
 
Dernière édition:

kjin

XLDnaute Barbatruc
Re : dessiner graphique dans chartspace owc et l'imprimer !!!

Bonsoir et bienvenue,
Lien supprimé (le paragraphe 3 notamment) t'aidera sans doute à formuler ta question et ainsi optimiser tes chances d'obtenir une réponse
A+
kjin
 

Discussions similaires

Statistiques des forums

Discussions
312 512
Messages
2 089 190
Membres
104 060
dernier inscrit
peffaumoikemmi-pro-5430