Page 1 of 1

Custom y-axis scaling - NEW PROBLEM

Posted: Tue Mar 01, 2005 8:51 am
by 9080645
hi,

I found a strange functionality from CUSTOM y-axis zooming: it works well, when I use max and min values of the "original" y-axis; that is, the values the graph was drawn for the first time with.

When I manually change the max and min values of the CUSTOM axis (by using the .SetMinMax function), the CalcPostPoint calculates the y-axis value according to the original y-axis values, EVEN THOUGH the y-axis SHOWS the "new" manually set values. I use a simple textfield for the max and min values, where the user can enter the wanted values. I also update the max and min values for every custom y-axis everytime I add a new datapoint to the series (I use OnTimer function to add new datapoints to series every 2 seconds. The data comes from an online connection through modem).

I need the functionality of setting the max and min values manually (via textfields), and zooming should temporarily zoom to the wanted area. UnZoom should reset the graph to the "original" OR user-set max and min values.

Thanks for any advice,

Mike

Posted: Tue Mar 01, 2005 2:40 pm
by Pep
Hi Mike,

I've tried to replicate the problem here using the following code, and it worked just fine :

Code: Select all

Dim YAxis

Private Sub Command1_Click()
Value = TChart1.Axis.Custom(YAxis).CalcPosPoint(220)
MsgBox Value
End Sub

Private Sub Command2_Click()
TChart1.Axis.Custom(YAxis).AxisPen.Color = vbBlue
TChart1.Axis.Custom(YAxis).SetMinMax Text1.Text, Text2.Text
End Sub

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).Add 10, "", clTeeColor
    .Series(0).Add 20, "", clTeeColor
    .Series(0).Add 15, "", clTeeColor
    .Series(0).Add 5, "", clTeeColor
    .AddSeries scLine
    .Series(1).Add 1000, "", clTeeColor
    .Series(1).Add 2000, "", clTeeColor
    .Series(1).Add 1500, "", clTeeColor
    .Series(1).Add 5000, "", clTeeColor
    .Aspect.View3D = False
    YAxis = .Axis.AddCustom(False)
    .Axis.Custom(YAxis).PositionPercent = 10
    .Series(1).VerticalAxisCustom = YAxis
End With
End Sub
If you still having problems, please post the code you're using with which we can reproduce "as is" the problem here.