B
Bruce Bowler
This code "worked" in 2003, but doesn't "work" in 2007...
In this context, "worked" means that in 2003, the X axis for both Y axes
were reversed, as requested. In 2007, only the X axis for the primary Y
axis is reversed, with the X axis for the secondary Y axis remains the
same (but the labels are reversed, so the graph looks odd and is hard/
impossible to interpret properly).
Also, the line marked with <<<<'s throws an error in 2007 but worked in
2003. Any ideas how to fix it?
Thanks!
Bruce
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets(mainsheet$).Range("E:G"),
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="tempsal"
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).AxisGroup = 2
ActiveChart.PlotArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = cruiseid$
.ChartTitle.AutoScaleFont = False
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Distance
(km)"
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
.MinimumScale = 0
.MaximumScale = 350
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = True
' .ScaleType = xlLinear <<<<<<<<<<<<<<<<<<<<<
End With
ActiveChart.SeriesCollection(2).AxisGroup = 1
ActiveChart.SeriesCollection(1).AxisGroup = 2
With ActiveChart
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Salinity
(ppt)"
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text =
"Temperature (degrees c)"
End With
For i = 1 To 2
ActiveChart.SeriesCollection(i).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
With Selection
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
Next i
In this context, "worked" means that in 2003, the X axis for both Y axes
were reversed, as requested. In 2007, only the X axis for the primary Y
axis is reversed, with the X axis for the secondary Y axis remains the
same (but the labels are reversed, so the graph looks odd and is hard/
impossible to interpret properly).
Also, the line marked with <<<<'s throws an error in 2007 but worked in
2003. Any ideas how to fix it?
Thanks!
Bruce
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets(mainsheet$).Range("E:G"),
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="tempsal"
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).AxisGroup = 2
ActiveChart.PlotArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = cruiseid$
.ChartTitle.AutoScaleFont = False
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Distance
(km)"
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
.MinimumScale = 0
.MaximumScale = 350
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = True
' .ScaleType = xlLinear <<<<<<<<<<<<<<<<<<<<<
End With
ActiveChart.SeriesCollection(2).AxisGroup = 1
ActiveChart.SeriesCollection(1).AxisGroup = 2
With ActiveChart
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Salinity
(ppt)"
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text =
"Temperature (degrees c)"
End With
For i = 1 To 2
ActiveChart.SeriesCollection(i).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
With Selection
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
Next i