gantt verticalsize

TeeChart for ActiveX, COM and ASP
Post Reply
gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

gantt verticalsize

Post by gatsoft » Wed May 05, 2010 1:23 pm

Hi
I am using the gantt chart and would like the verticalheight to be just short of full available height. In other words if the available height on the page was 100 and I had 10 gantts in the height I would like to set it to 9. What I cant find out is what the available viewing area is after the axis labels and titles are taken into account. I have tried CalcYSizeValue(0.5) as well but this seems to change each time. I want to adjust the height after the chart is complete. Using Visual Foxpro 9
Allen

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

Re: gantt verticalsize

Post by Narcís » Thu May 06, 2010 9:04 am

Hi Allen,

I'm not familiar with Visual Fox Pro so I have made an example in Visual Basic 6. Basically, what you need to do is calculating ChartRect area after the chart has been plotted:

Code: Select all

Private Sub Form_Load()
    TChart1.Aspect.View3D = False
    TChart1.AddSeries scGantt
    TChart1.Series(0).FillSampleValues 10
    TChart1.Environment.InternalRepaint
End Sub

Private Sub TChart1_OnAfterDraw()
    With TChart1
        ChartRectHeight = .Axis.Left.IEndPos - .Axis.Left.IStartPos
        .Series(0).asGantt.Pointer.VerticalSize = (ChartRectHeight / .Series(0).Count) / 2
    End With
End Sub
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

gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

Re: gantt verticalsize

Post by gatsoft » Thu May 06, 2010 7:43 pm

That seems not to work for me. I checked the result and the IEndPos and IStartPos were rather small. Because I know I had 12 gantts heigh I used 12 as the divide but the result was small gantt bars.
Im using a ganntt chart to display items in time. It could be more than one bar per line. I also use two gantt series because I need labels I cant do with the single gantt. I say this because maybe there is a reason there that its not working right.
I cant send an example either as its part of a large program
I noticed that OnAfterDraw also works after each bar, or seems to anyway.
Allen

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

Re: gantt verticalsize

Post by Narcís » Fri May 07, 2010 2:08 pm

Hi Allen,

Have you tried doing a simple application just doing what I posted in my previous reply? Does this work fine at your end?

Please notice TChart1.Environment.InternalRepaint call. This is to force the chart to be painted internally so that axes have valid values when getting to the OnAfterDraw event. Have you tried this in your application?

Thanks in advance.
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

gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

Re: gantt verticalsize

Post by gatsoft » Sun May 09, 2010 12:50 pm

I have made a simple two page pageframe with V7 and V8 of the activex version. Identical code in the init to make a gantt with 10 bars and call the internalrepaint
I put a timer on the form and an on key to enable it making it self disabled. The timer had the code above actioned on both charts with a message of the rect height reported by the code.
V8 reported a height of 301 and proceeded to make the verticalheight of the bars correct. V7 reported a rect height of 26 and the height was small.
It seems V7 has something different. My problem is I have V7 out in the field and would rather not have to update those.
Is there a setting I have missed maybe the way teechart reports the sizes?
Thanks
Allen

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

Re: gantt verticalsize

Post by Narcís » Mon May 10, 2010 11:07 am

Hi Allen,
Is there a setting I have missed maybe the way teechart reports the sizes?
I don't think it should be different. Does the simple example I posted work fine in v7? If it works fine but your project doesn't could you please attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.
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

Post Reply