adjusting scale on vertical axis

TeeChart for ActiveX, COM and ASP
Post Reply
dcurrier
Newbie
Newbie
Posts: 32
Joined: Thu Jul 15, 2004 4:00 am

adjusting scale on vertical axis

Post by dcurrier » Thu Nov 11, 2004 10:18 pm

I guess I'm having a mental block on this one.

I put in a series of 200 candle points and show 50 at a time.

I want the left axis to be scaled to the points visible on the screen as I scroll. Right now it remains scaled to the entire data set.

I can do the scrolling programatically.

I must have some settings incorrect. I didn't notice this in the examples.

Thanks,

David

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Nov 12, 2004 9:41 am

Hi David,

you can use the MinVisibleSeriesValue and MaxVisibleSeriesValue methods :
TChart1.Axis.Left.SetMinMax TChart1.Axis.Left.MinVisibleSeriesValue(False, 0), TChart1.Axis.Left.MaxVisibleSeriesValue(False, 0)

dcurrier
Newbie
Newbie
Posts: 32
Joined: Thu Jul 15, 2004 4:00 am

Post by dcurrier » Fri Nov 12, 2004 12:47 pm

Pep,

In the interest of simplifying the question, I indicated there was only 1 series on the chart. In fact, there are several and I want them all included.

I had seen the MinVisibleSeriesValue (and Max..) but I wasn's sure of the values.

When I tried your example, it didn't display any data until I changed the AllSeries value to true. I tried several values for the SeriesIndex. Zero allows the chart to display the first time but and chart movement causes an error.

With MultiChart.Axis.Left
.SetMinMax .MinVisibleSeriesValue(True, 0), .MaxVisibleSeriesValue(True, 0)
End With

I put this at the end of the chart display routine.

I forgot to say I'm using Version 6.

David

dcurrier
Newbie
Newbie
Posts: 32
Joined: Thu Jul 15, 2004 4:00 am

Tried again

Post by dcurrier » Sat Nov 13, 2004 12:29 am

I spent some more time trying to get this to work.

It now definitely changes the .max and .min values but it doesn't include all the points. They don't go high or low enough to cover all the visible points.

I have several series displayed on the chart at once including a function. Series0 is a candlestick series.

With MultiChart
.Environment.InternalRepaint
tempIncr = .Axis.Left.Increment
tempMax = .Axis.Left.MaxVisibleSeriesValue(False, 0)
tempMin = .Axis.Left.MinVisibleSeriesValue(False, 0)
tempMax = tempMax + tempIncr
tempMin = tempMin - tempIncr

.Axis.Left.SetMinMax tempMin, tempMax
End With

I was trying to bump the increment myself with tempIncr but it was nowhere near enough to cover the missing points.

If I change the "false" to "true" in both statements (which I thought was the answer for "AllSeries" I get an object failed error. Should I change the second parameter from 0 to something else?

I feel like I'm getting closer but I'm just guessing at this point. I thought this would be easier than it apparently is.

I'm using V6 of TeeChartAX and VB6.

Thanks again.

David

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 15, 2004 10:02 am

Hi David,
It now definitely changes the .max and .min values but it doesn't include all the points. They don't go high or low enough to cover all the visible points.

I have several series displayed on the chart at once including a function. Series0 is a candlestick series.
Yes, that's because TeeChart calculates the MaxVisibleSeriesValue and MinVisibleSeriesValue using the Close Values of a Candle Series.
In your case you will have to use the MinVisibleValue and MaxVisibleValue methods of the Series, but as you're using more than one Series you will have to iterate through all the series to check which is the MinVisibleValue and MaxVisibleValue of each one. This method allow you to select the ValueList you want to check.

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scCandle
    .Series(0).FillSampleValues 200
    .Page.MaxPointsPerPage = 10
    .Environment.InternalRepaint
End With
End Sub

Private Sub TChart1_OnAfterDraw()
With TChart1
    .Axis.Left.SetMinMax .Series(0).MinVisibleValue(3), .Series(0).MaxVisibleValue(2)
End With
End Sub

dcurrier
Newbie
Newbie
Posts: 32
Joined: Thu Jul 15, 2004 4:00 am

Post by dcurrier » Mon Nov 15, 2004 1:44 pm

Hi Pep,

Yes, that's because TeeChart calculates the MaxVisibleSeriesValue and MinVisibleSeriesValue using the Close Values of a Candle Series.
I see this as problematic because the High and low values need to be displayed as well. They can be very useful to the user. It doesn't seem correct to just use the close values.
In your case you will have to use the MinVisibleValue and MaxVisibleValue methods of the Series, but as you're using more than one Series you will have to iterate through all the series to check which is the MinVisibleValue and MaxVisibleValue of each one. This method allow you to select the ValueList you want to check.

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scCandle
    .Series(0).FillSampleValues 200
    .Page.MaxPointsPerPage = 10
    .Environment.InternalRepaint
End With
End Sub

Private Sub TChart1_OnAfterDraw()
With TChart1
    .Axis.Left.SetMinMax .Series(0).MinVisibleValue(3), .Series(0).MaxVisibleValue(2)
End With
End Sub
In this example, what does the 3 refer to in ".MinVisibleValue(3)" ? Is that saying to use the series 3 (for example) min visible? I notice you don't set the AllSeries parameter to either "false" or "true".

(.MinVisibleValues(False,3)

What is supposed to happen if I set the "AllSeries" parameter to "true"?


Thanks, David

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 15, 2004 2:36 pm

Hi David,
In this example, what does the 3 refer to in ".MinVisibleValue(3)" ? Is that saying to use the series 3 (for example) min visible? I notice you don't set the AllSeries parameter to either "false" or "true".

(.MinVisibleValues(False,3)
No, this is a different method than the "Axis.Left.MinVisibleSeriesValue(False, 0)". The 3 refers to the index of the ValueList (in that case low).

From the help :
function MinVisibleValue(valueList: Integer): Double;

Type Library
TeeChartX

Description
Returns the Min Visible Value for a given ValueList.

Example
--------------
With TChart1.Series(0)
If .Count > 0 Then
OpenLabelMx.Caption = .ValueLists.Items(4).Name
OpenLabelMn.Caption = .ValueLists.Items(4).Name
OpenValMx.Caption = .MaxVisibleValue(4)
OpenValMn.Caption = .MinVisibleValue(4)
End if
End with

See also:
IAxis.MinVisibleSeriesValue

TeeChart Pro ActiveX Control Documentation. Copyright 1997-2004 Steema Software SL.
What is supposed to happen if I set the "AllSeries" parameter to "true"?
Should return the Max and Min value between all Active Series currently visible Points related to that Axis.

dcurrier
Newbie
Newbie
Posts: 32
Joined: Thu Jul 15, 2004 4:00 am

Post by dcurrier » Tue Nov 23, 2004 4:11 pm

Pep,

I finally got back to this issue and worked my way thru the solution.

I had some trouble finding the values for the lower band on the Bollinger band function but I finally got it to work.

I still got an error on the AllSeries method but it may be because some series did not have any values. Anyhow, I'll save that for another day since the rest is working.

Thanks for your help on this.

David

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Nov 24, 2004 8:45 am

Hi David,

ok, I'm glad to know that works. If you sill getting errors or you've any problem send me the code with which I can reproduce the problem and we'll try to find a solution.

Post Reply