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
| Set graph3 = base.Worksheets("template").ChartObjects.Add(40, 6850, 430, 350)
With graph3.Chart
.ChartType = xl3DPie
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = Worksheets("param et graph").Range("A51:A55")
.SeriesCollection(1).Values = Worksheets("param et graph").Range("C51:C55")
.SeriesCollection(1).Name = "Votre financement sur base annuelle"
.Elevation = 35
.Rotation = 240
.HasLegend = False
.ChartTitle.Font.Size = 14
.ChartArea.Interior.ColorIndex = xlPatternNone
.ChartArea.Border.ColorIndex = xlPatternNone
.PlotArea.Interior.ColorIndex = xlPatternNone
.PlotArea.Border.ColorIndex = xlPatternNone
.PlotArea.Width = Round(.ChartArea.Width * 0.35, 0)
.PlotArea.Top = Round(.ChartArea.Height / 2 - .PlotArea.Height / 2, 0)
.PlotArea.Left = Round(.ChartArea.Width / 2 - .PlotArea.Width / 2, 0)
.SeriesCollection(1).HasDataLabels = True
.SeriesCollection(1).DataLabels.Position = xlLabelPositionOutsideEnd
Dim pt As Point
For Each pt In graph3.Chart.SeriesCollection(1).Points
pt.Explosion = 10
Next pt
.SeriesCollection(1).HasLeaderLines = True
.SeriesCollection(1).ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent
.SeriesCollection(1).DataLabels.Font.Size = 7
x_centre = .PlotArea.Left + (.PlotArea.Width / 2)
y_centre = .PlotArea.Top + (.PlotArea.Height / 2)
.SeriesCollection(1).Points(1).DataLabel.Left = Round(x_centre + 1.5 * (.SeriesCollection(1).Points(1).DataLabel.Left - x_centre), 0)
.SeriesCollection(1).Points(1).DataLabel.Top = Round(y_centre + 1.5 * (.SeriesCollection(1).Points(1).DataLabel.Top - y_centre), 0)
.SeriesCollection(1).Points(2).DataLabel.Left = Round(x_centre + 1.5 * (.SeriesCollection(1).Points(2).DataLabel.Left - x_centre), 0)
.SeriesCollection(1).Points(2).DataLabel.Top = Round(y_centre + 1.5 * (.SeriesCollection(1).Points(2).DataLabel.Top - y_centre), 0)
.SeriesCollection(1).Points(3).DataLabel.Left = Round(x_centre + 1.5 * (.SeriesCollection(1).Points(3).DataLabel.Left - x_centre), 0)
.SeriesCollection(1).Points(3).DataLabel.Top = Round(y_centre + 1.5 * (.SeriesCollection(1).Points(3).DataLabel.Top - y_centre), 0)
.SeriesCollection(1).Points(4).DataLabel.Left = Round(x_centre + 1.5 * (.SeriesCollection(1).Points(4).DataLabel.Left - x_centre), 0)
.SeriesCollection(1).Points(4).DataLabel.Top = Round(y_centre + 1.5 * (.SeriesCollection(1).Points(4).DataLabel.Top - y_centre), 0)
.SeriesCollection(1).Points(5).DataLabel.Left = Round(x_centre + 1.5 * (.SeriesCollection(1).Points(5).DataLabel.Left - x_centre), 0)
.SeriesCollection(1).Points(5).DataLabel.Top = Round(y_centre + 1.5 * (.SeriesCollection(1).Points(5).DataLabel.Top - y_centre), 0)
End With |
Partager