trouble drawing a shape

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

trouble drawing a shape

Post by dcurrier » Sat Jun 11, 2005 7:28 pm

I want to draw a rectangle on my chart. I set up a rectangular shape series with the editor.

I did a small test program and it seems Ok but in my production prog I get a method error on the .asShape.X0 statement.

I'm using VB6 and Tchart 6.

The only thing I see that appears different in the code is the production prog uses series 21, test uses 0. Is this an issue?

Anyhow, maybe someone can tell me where to look.

Test orig:

Code: Select all

Dim adjptrend As Double
Dim threeperY0 As Double
Dim threeperY1 As Double

adjptrend = 90
threeperY0 = 684.5
threeperY1 = 687.9

With TChart1.Series(0)
    .asShape.X0 = adjptrend - 3
    .asShape.X1 = adjptrend - 1
    .asShape.Y0 = threeperY0
    .asShape.Y1 = threeperY1
End With
This appears to work.

The production prog:

Code: Select all

' these are dimensioned as doubles elsewhere
adjPtrEnd = 90
threePerY0 = 684.5
threePerY1 = 687.9
' i forced these 3 values to match the data for testing purposes
'
With MultiChart.Series(21)
    .XValues.DateTime = False
    .asShape.X0 = adjPtrEnd - 3
    .asShape.X1 = adjPtrEnd - 1
    .asShape.Y0 = threePerY0
    .asShape.Y1 = threePerY1
End With
This gives a method error on the first .asShape statement

The other series not shown are either candlesticks or line series.

Any help would be appreciated.

David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jun 13, 2005 8:39 am

Hi David,
The only thing I see that appears different in the code is the production prog uses series 21, test uses 0. Is this an issue?
This would mean that the problematic series is number 22 in your chart. This value is the series index in a chart and it starts at zero.

Which is the error you get?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

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

Post by dcurrier » Tue Jun 14, 2005 5:28 pm

I finally got back to messing with this problem. Here is what I found.

In the production program I had some initialization steps where I cleared the series (all of them that I was using). I didn't have this in the test program.

If I use the .clear option in either the test or the production program, I get the same error: "Method 'X0' of object 'IShapeSeries' failed.

Take out the .clear and they both work fine. (You can see this by adding a .clear statement to the test code above.) The problem is I want to get rid of any prior box. In most cases I replace the old box with a new one and that is fine but occasionally I just want to get rid of the old one and not replace it. That's why I was using the .clear. It seems to work if I make the series(21) inactive but I would rather clear it.

While I am doing this, I would like to make the box a contain a transparent screen to sort of highlight the box. I want to see the candle series behind the box but I want the effect of having the box highlighted. Is that clear? How might I do this?

Any ideas would be appreciated.

David

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

Post by Pep » Fri Jun 17, 2005 4:16 pm

Hi David,
Take out the .clear and they both work fine. (You can see this by adding a .clear statement to the test code above.) The problem is I want to get rid of any prior box. In most cases I replace the old box with a new one and that is fine but occasionally I just want to get rid of the old one and not replace it. That's why I was using the .clear. It seems to work if I make the series(21) inactive but I would rather clear it.
Yes, you're correct, it's a known problem, already down our defect list. We'll try to fix it for the next maintenance releases.
In meantime a work around I've found is to add a FillSampleValues call before you want to assign the X0,Y0 etc.. values., like the following code :

Code: Select all

Private Sub Command1_Click()
    Dim adjptrend As Double
    Dim threeperY0 As Double
    Dim threeperY1 As Double
    
    adjptrend = 90
    threeperY0 = 684.5
    threeperY1 = 687.9
    
    TChart1.Series(1).FillSampleValues 1
    With TChart1.Series(1)
        .asShape.X0 = adjptrend - 3
        .asShape.X1 = adjptrend - 1
        .asShape.Y0 = threeperY0
        .asShape.Y1 = threeperY1
    End With
End Sub
While I am doing this, I would like to make the box a contain a transparent screen to sort of highlight the box. I want to see the candle series behind the box but I want the effect of having the box highlighted. Is that clear? How might I do this?
This feature still not available, for the moment the shape can be totally transparent but there's no way to assign a transparency value. It's on our wish list to be considered for the next releases.

Post Reply