ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Graphing (https://www.excelbanter.com/excel-programming/415974-graphing.html)

Eric

Graphing
 
Is there away to have two (2) y-axises? I want english measurements on the
left and metric on the right. I have both calculated out in cells but am
wondering how to make the right side of the graph have anything. Any help
would be appreciated. Thank you in advance.
Eric

Barb Reinhardt

Graphing
 
What units do you want displayed on each axis? Inches/Feet/Miles cm/m/km???

That would help.
--
HTH,
Barb Reinhardt



"Eric" wrote:

Is there away to have two (2) y-axises? I want english measurements on the
left and metric on the right. I have both calculated out in cells but am
wondering how to make the right side of the graph have anything. Any help
would be appreciated. Thank you in advance.
Eric


Barb Reinhardt

Graphing
 
You're going to have to add a second series to the chart and have it use the
secondary axis. To "match" the scales, use something like this for code.
I converted from Feet to Meters here. Change the points for the second
series so they aren't displayed.

With ActiveChart.Axes(xlValue)
myMax = .MaximumScale
myMin = .MinimumScale
End With

With ActiveChart.Axes(xlValue, xlSecondary)
.MaximumScale = myMax * 0.3062
.MinimumScale = myMin * 0.3062
End With

--
HTH,
Barb Reinhardt



"Eric" wrote:

Is there away to have two (2) y-axises? I want english measurements on the
left and metric on the right. I have both calculated out in cells but am
wondering how to make the right side of the graph have anything. Any help
would be appreciated. Thank you in advance.
Eric


Eric

Graphing
 
Barb,
I have tried the code below and still am getting an error here is what I
have for the code. By the way I am going from pounds per cubic foot to
kilograms per meter cubed. Thank you for your help

ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
With ActiveChart.Axes(xlValue)
..MinimumScale = 1
..MaximumScale = 1
..MinorUnitIsAuto = True
..MajorUnitIsAuto = True
..Crosses = xlAutomatic
..ReversePlotOrder = False
..ScaleType = False
End With
ActiveWindow.Visible = False
Range("b41").Select

ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
..MaximumScale = ActiveSheet.Range("t12")
..MinimumScale = ActiveSheet.Range("s12")
..MinorUnit = 20
..MajorUnit = 1
..Crosses = xlAutomatic
..ReversePlotOrder = False
ScaleType = False
..TickLabels.NumberFormat = "0.0"

End With

'secondary axis
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue, xlSecondary)
..MaximumScale = ActiveSheet.Range("t12") * 16.01846
..MinimumScale = ActiveSheet.Range("s12") * 16.01846
End With

"Barb Reinhardt" wrote:

You're going to have to add a second series to the chart and have it use the
secondary axis. To "match" the scales, use something like this for code.
I converted from Feet to Meters here. Change the points for the second
series so they aren't displayed.

With ActiveChart.Axes(xlValue)
myMax = .MaximumScale
myMin = .MinimumScale
End With

With ActiveChart.Axes(xlValue, xlSecondary)
.MaximumScale = myMax * 0.3062
.MinimumScale = myMin * 0.3062
End With

--
HTH,
Barb Reinhardt



"Eric" wrote:

Is there away to have two (2) y-axises? I want english measurements on the
left and metric on the right. I have both calculated out in cells but am
wondering how to make the right side of the graph have anything. Any help
would be appreciated. Thank you in advance.
Eric


Eric

Graphing
 
Barb,
I have figured out the problem that I was having but of coarse there is a
new issue now. when I run the macro for the chart it doesn't graph anything
out. The x and y axises are there but nothing for a series. When I go to
the series to check there is no x axis pick but the y axis is. When I pick
the x axis location it then graphs for me and all is well. Any help would be
appreciated. Thank you

"Eric" wrote:

Barb,
I have tried the code below and still am getting an error here is what I
have for the code. By the way I am going from pounds per cubic foot to
kilograms per meter cubed. Thank you for your help

ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
With ActiveChart.Axes(xlValue)
.MinimumScale = 1
.MaximumScale = 1
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = False
End With
ActiveWindow.Visible = False
Range("b41").Select

ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MaximumScale = ActiveSheet.Range("t12")
.MinimumScale = ActiveSheet.Range("s12")
.MinorUnit = 20
.MajorUnit = 1
.Crosses = xlAutomatic
.ReversePlotOrder = False
ScaleType = False
.TickLabels.NumberFormat = "0.0"

End With

'secondary axis
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue, xlSecondary)
.MaximumScale = ActiveSheet.Range("t12") * 16.01846
.MinimumScale = ActiveSheet.Range("s12") * 16.01846
End With

"Barb Reinhardt" wrote:

You're going to have to add a second series to the chart and have it use the
secondary axis. To "match" the scales, use something like this for code.
I converted from Feet to Meters here. Change the points for the second
series so they aren't displayed.

With ActiveChart.Axes(xlValue)
myMax = .MaximumScale
myMin = .MinimumScale
End With

With ActiveChart.Axes(xlValue, xlSecondary)
.MaximumScale = myMax * 0.3062
.MinimumScale = myMin * 0.3062
End With

--
HTH,
Barb Reinhardt



"Eric" wrote:

Is there away to have two (2) y-axises? I want english measurements on the
left and metric on the right. I have both calculated out in cells but am
wondering how to make the right side of the graph have anything. Any help
would be appreciated. Thank you in advance.
Eric



All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com