m_sonj
Messages postés1Date d'inscriptionjeudi 8 juin 2006StatutMembreDernière intervention26 juillet 2007
-
26 juil. 2007 à 12:09
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013
-
26 juil. 2007 à 12:59
Bonjour,
J'ai un bout de code qui génère un graphique (camembert) à partir d'un tableau Excel,
Je souhaite afficher le pourcentage de chaque part à l'interieur du camembert comme le montre l'image ci-dessous.
Voici mon code :
''''''''''''''''''''''''''''''''''''''''''''''''''
'Generate TYPES graph
''''''''''''''''''''''''''''''''''''''''''''''''''
Charts.Add
ActiveChart.ChartType = xlPie
Dim i As Integer
i = Sheets("Filters").Range("B65536").End(xlUp).Row
ActiveChart.SetSourceData Source:=Sheets("Filters").Range("B2:C" & i), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Graphs"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Répartition des tâches"
.SeriesCollection(1).Points(1).ApplyDataLabels ShowPercentage:=True
.SeriesCollection(1).Points(2).ApplyDataLabels ShowPercentage:=True
End With
'Place graph in a specific place
ActiveSheet.ChartObjects(1).Left = Range("B2").Left
ActiveSheet.ChartObjects(1).Top = Range("B2").Top
'Resize graph
ActiveSheet.ChartObjects(1).Width = Range("B2:E2").Width
ActiveSheet.ChartObjects(1).Height = Range("B2:B17").Height