Hello group,
I am having trouble positioning the Left Axis where I want it. It needs to be passing directly through "0" on the Bottom Axis, but is offset to the left. Does anyone know if there is a way to make it always pass through "0" on the bottom axis? I tried the .PositionPercent = 50, but sometimes the "0" point is not in the middle of the bottom axis.
Thanks,
Bob
Private Sub Form_Load()
With TChart1.Axis.Left
.Automatic = True
.MaximumOffset = 10
.MinimumOffset = 10
End With
With TChart1.Axis.Bottom
.Automatic = True
.MaximumOffset = 10
.MinimumOffset = 10
End With
TChart1.Axis.Left.PositionPercent = 50
TChart1.Axis.Bottom.PositionPercent = 50
End Sub
Can't position Left Axis accurately
Hi Bob,
I'm not sure it the following is what you are trying to do :
You can use the SetMinMax method so the Left axis will always pass through "0" on the bottom axis.
I'm not sure it the following is what you are trying to do :
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues (10)
With TChart1.Axis.Left
.Automatic = True
.MaximumOffset = 10
.MinimumOffset = 10
End With
With TChart1.Axis.Bottom
.Automatic = True
.MaximumOffset = 10
.MinimumOffset = 10
End With
TChart1.Axis.Left.PositionPercent = 50
TChart1.Axis.Bottom.PositionPercent = 50
TChart1.Axis.Bottom.SetMinMax -10, 10
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Hey Pep,
I am trying to let the range of the Left and Bottom axes be automatic and then position the Left axis so that it passes through zero on the bottom axis. The line: TChart1.Axis.Bottom.SetMinMax -10, 10 forces the range to manual (if I'm not mistaken). That's fine, if it can't be done while using the TChart1.Axis.Bottom.Automatic = True, then I will go ahead and switch to the TChart1.Axis.Bottom.Automatic = False. I was hoping that I could just position the left axis at any point on the bottom axis with a simple command.
Thanks for your help,
Bob
I am trying to let the range of the Left and Bottom axes be automatic and then position the Left axis so that it passes through zero on the bottom axis. The line: TChart1.Axis.Bottom.SetMinMax -10, 10 forces the range to manual (if I'm not mistaken). That's fine, if it can't be done while using the TChart1.Axis.Bottom.Automatic = True, then I will go ahead and switch to the TChart1.Axis.Bottom.Automatic = False. I was hoping that I could just position the left axis at any point on the bottom axis with a simple command.
Thanks for your help,
Bob
Hi Bob,
sorry to not let you know that thiere's another way in case you want to use Automatic axis. You can set the position of the left axis to the 0 position of XAxis using the following code :
sorry to not let you know that thiere's another way in case you want to use Automatic axis. You can set the position of the left axis to the 0 position of XAxis using the following code :
Code: Select all
With TChart1
.Environment.InternalRepaint
chartRectWidth = .Axis.Right.Position - .Axis.Left.Position
seriesXLocation = .Series(0).CalcXPosValue(0) 'X-pos of 0 value
relativeXPercent = (seriesXLocation - .Axis.Left.Position) / chartRectWidth * 100
.Axis.Left.PositionPercent = relativeXPercent
End With
Pep Jorge
http://support.steema.com
http://support.steema.com