rafou29
XLDnaute Junior
Bonjour,
Avec le code ci-dessous, j'arrive à faire apparaitre sur différentes feuilles des histogrammes. Actuellement, j'ai des dates en X et en Y des temps ou des pourcentages.
Le problème est qu'il m'arrive d'avoir pour la même date plusieurs valeurs or mon graphe ne m'en affiche qu'une.
Je souhaiterais que pour la même date il m'affiche mes différentes valeurs les unes sur les autres (histogramme empilé).
Voici mon code:
Private Sub CommandButton55_Click()
'Création du 1er histogramme: min=f(date)
Sheets("Sheet3").Select
Range("B3:C30").Select
Application.CutCopyMode = False
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet3").Range("B3:C30") _
, PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!B3:B30"
ActiveChart.SeriesCollection(1).Name = "=""Chrono"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet3"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ("Chrono" & Periode)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Minutes"
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
'Création du 2nd histogramme: %=f(date)
Sheets("Vue_Generale").Select
Range("B3:C30").Select
Application.CutCopyMode = False
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Vue_Generale").Range("B3:C30") _
, PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=Vue_Generale!B3:B30"
ActiveChart.SeriesCollection(1).Name = "=""Mc Donald"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Vue_Generale"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ("Mc Donald" & Periode)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "%"
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
End Sub
Merci de votre attention !
Avec le code ci-dessous, j'arrive à faire apparaitre sur différentes feuilles des histogrammes. Actuellement, j'ai des dates en X et en Y des temps ou des pourcentages.
Le problème est qu'il m'arrive d'avoir pour la même date plusieurs valeurs or mon graphe ne m'en affiche qu'une.
Je souhaiterais que pour la même date il m'affiche mes différentes valeurs les unes sur les autres (histogramme empilé).
Voici mon code:
Private Sub CommandButton55_Click()
'Création du 1er histogramme: min=f(date)
Sheets("Sheet3").Select
Range("B3:C30").Select
Application.CutCopyMode = False
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet3").Range("B3:C30") _
, PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!B3:B30"
ActiveChart.SeriesCollection(1).Name = "=""Chrono"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet3"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ("Chrono" & Periode)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Minutes"
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
'Création du 2nd histogramme: %=f(date)
Sheets("Vue_Generale").Select
Range("B3:C30").Select
Application.CutCopyMode = False
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Vue_Generale").Range("B3:C30") _
, PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=Vue_Generale!B3:B30"
ActiveChart.SeriesCollection(1).Name = "=""Mc Donald"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Vue_Generale"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ("Mc Donald" & Periode)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "%"
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
End Sub
Merci de votre attention !
Dernière édition: