Software FX Community

# How to align zero for two Y axes? (Cfx5 CS)

## Recommended Posts

```You are right, there is no easy way to align both Y-axis, here is the
formula to adjust the 2nd Y-axis scale (in VB):
Dim dUp As Double
Dim dLow As Double
Dim dMax
' Determine the percentage of positive and negative
dUp = ChartFX1.Axis(AXIS_Y).Max / (ChartFX1.Axis(AXIS_Y).Max -
ChartFX1.Axis(AXIS_Y).Min)
dLow = -(1 - dUp)
' Determine whether to increase the Max or decrease the min. I want to make
sure the scale is bigger not smaller (which could clip meningfull data)
dMax = -(dUp * ChartFX1.Axis(AXIS_Y2).Min) / (1 - dUp)
If dMax > ChartFX1.Axis(AXIS_Y2).Max Then
ChartFX1.Axis(AXIS_Y2).Max = dMax
Else
ChartFX1.Axis(AXIS_Y2).Min = (dLow * ChartFX1.Axis(AXIS_Y2).Max) / (1 +
dLow)
End If
I hope this helps !
--
FP
Software FX, Inc.```
##### Share on other sites

```Hi,
Is it possible to align the zero line of Y axis
with the zero line of the secondary Y axis?
The problem is that I use two Y axes and I
cannot say anything about the range of the Y
values for both of them.  When the number of steps
above the zero and below the zero differs, the
zero lines are not aligned.
See the attached saved chart (created in ActiveX
Control Test Container).  The grid lines are
visible for both Y axes.  Notice that the zero
lines are not aligned.
Do I have to set the range of values so that the
number of steps above and below the zero is
equal (i.e. not automatically, some not simple
computing needed)?
Thanks,
Petr
--
prikrylp at skil dot cz```

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×