Jump to content
Software FX Community

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

User (Legacy)

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 -


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


ChartFX1.Axis(AXIS_Y2).Min = (dLow * ChartFX1.Axis(AXIS_Y2).Max) / (1 +


End If

I hope this helps !



Software FX, Inc.

Link to comment
Share on other sites


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)?




prikrylp at skil dot cz

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...