Resize chart

TeeChart for ActiveX, COM and ASP
JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Resize chart

Post by JAV » Wed Apr 25, 2012 5:21 pm

Hi. We want to maximize our window, and obviously, we need to adjust the chart to the new window size. How can we setup this? We are trying with chart.width and Chart.Height properties but it just allows modify to a lower size than the original, the opposite truncates the chart.

Best regards,

JAV

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Thu Apr 26, 2012 7:34 am

Hi JAV,

I've tried to drop a chart and two buttons in a new form and this code seems to behave as expected. Doesn't it for you?

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.Width:=Chart1.Width-5;
  Chart1.Height:=Chart1.Height-5;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Chart1.Width:=Chart1.Width+5;
  Chart1.Height:=Chart1.Height+5;
end;
Note you can also use Align property if you want your chart to always be in the left/right/top/bottom/client of your form.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Resize chart

Post by JAV » Thu Apr 26, 2012 5:45 pm

Hi Yeray, thanks for replying.

I am doing exactly that:

Code: Select all

Chart1.Width:=Chart1.Width+300;
Chart1.Height:=Chart1.Height+15;
But the result is shown in the attached images :cry:
Before.JPG
Original size
Before.JPG (63.65 KiB) Viewed 27896 times
After.JPG
With increasing size
After.JPG (70.8 KiB) Viewed 27899 times
I tried to put

Code: Select all

Chart1.AutoSize = TRUE
but I get an error. I don't know if that is the solution but I don't find what is the appropriate sentence.

Thank you very much.

Best regards,

JAV

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Fri Apr 27, 2012 9:30 am

Hi JAV,

What TeeChart and IDE versions are you using?
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Resize chart

Post by JAV » Mon Apr 30, 2012 4:17 pm

Hi Yeray, thanks for replying.

I'm using TeeChart Pro v8.0.1.1.101222. With OpenEdge Studio 10.2B (4gl). The code is the following:

Code: Select all

// Asigno el puntero de TChart a una variable
gr = chgr1:tc1.

// Guardo el tamaño original de mi ventana
yy_bef = CURRENT-WINDOW:HEIGHT.
xx_bef = CURRENT-WINDOW:WIDTH.

// Asigno el tamaño de la sesión a mi ventana
CURRENT-WINDOW:HEIGHT = SESSION:HEIGHT-CHARS.
CURRENT-WINDOW:WIDTH  = SESSION:WIDTH-CHARS.

// Guardo el nuevo tamaño de mi ventana
yy_aft = CURRENT-WINDOW:HEIGHT.
xx_aft = CURRENT-WINDOW:WIDTH.

// Asigno al TChart las dimensiones que debe incrementar
gr:HEIGHT = gr:HEIGHT + (yy_aft - yy_bef).
gr:WIDTH  = gr:WIDTH  + (xx_aft - xx_bef).
Thank you very much.

Best regards,

JAV

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Wed May 02, 2012 9:52 am

Hi JAV,

I was trying it with Delphi, excuse me.
Since we don't have OpenEdge Studio here, I've tried now with TeeChart v8.0.1.1.101222 in Visual Basic 6 and this seems to work fine for me with a chart into the form and a button doing this:

Code: Select all

Private Sub Command1_Click()
  TChart1.Width = TChart1.Width + 30
  TChart1.Height = TChart1.Height + 30
End Sub
So this may be something related to this IDE or some other setting you are using that I may be missing.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Resize chart

Post by JAV » Mon May 07, 2012 6:53 pm

Hi,

I made every test that I could and finally I guess that there is something related with the object of OCX: the OCX is on my window, and my window is being maximized, as well as the image but not the object... That is why the image appears truncated.... is like the ocx is upon a frame or something which I am not maximizing in a properly way. Could you please show me how could I set this attribute on the OCX window or frame, because this on the image is already working?

Thank you very much

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Tue May 08, 2012 10:12 am

Hola,

TeeChart ActiveX isn't embedded into any frame or anything else. I still think it has to be some particularity in your IDE because I can't reproduce it with VB6.
I'd suggest you to try to force a repaint (Chart1.Environment.InternalRepaint) after resizing/maximizing to see if it changes something.
You could also try making the chart invisible and visible again, also after resizing/maximizing.

If you still have problems with it, don't hesitate to let us know.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Resize chart

Post by JAV » Tue May 08, 2012 3:22 pm

Hi Yeray:

Can you tell me please where is de property: Auto size, or how to maximize the ocx?
When I put:

Code: Select all

Chart1.AutoSize = TRUE
or

Code: Select all

Chart1.MAXIMIZE = TRUE
It returns the attached error:
Error.JPG
Error.JPG (11.39 KiB) Viewed 27817 times
Thank you very much

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Wed May 09, 2012 8:03 am

Hi JAV,

There's no AutoSize property for the TeeChart.TChart object. There is an AutoSize property for Annotation tool, TextShape,... and similar objects, but not for the chart itself.
It has to be something particular in your IDE. Maybe is IDE who embeds the COM components into something that is causing all this: some extra properties, what looks as a frame that isn't resized with the component inside it,... just an hypothesis.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Resize chart

Post by JAV » Wed May 09, 2012 7:03 pm

Hola Yeray,

Right now I am working directly on TeeChart Office just to understand how this functionality really works before implement it. There is an attribute or property named Auto Size (please see attached images). This "auto size" option allows to do exactly what I need:
When it is inactive the chart is in its original size even though the frame or window is maximized , when it is active the chart fit the window size. What is the appropriated command line to do this?
Thank you very much, regards
Attachments
With_AutoSize.JPG
With_AutoSize.JPG (163.22 KiB) Viewed 27791 times
Without_AutoSize.JPG
Without_AutoSize.JPG (122.87 KiB) Viewed 27782 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Resize chart

Post by Yeray » Fri May 11, 2012 2:35 pm

Hi JAV,

TeeChart Office is developed with TeeChart VCL, not with TeeChart ActiveX.

In VB6 you can use the Align property as mentioned above.
However, I'm not sure in your IDE. And there isn't, either in VB6, a property to align the control to the four sides, like in delphi alClient.

To do the same in TeeChart ActiveX, you still could use a resize event to assign the new chart dimensions.
For example, in VB6, if I have the chart aligned to the bottom, I can use the chart's resize event:

Code: Select all

Private Sub Form_Load()
  TChart1.Align = vbAlignBottom
End Sub

Private Sub TChart1_OnResize()
  TChart1.Height = Form1.ScaleHeight
End Sub
Otherwise, if I don't have the chart aligned anywhere, I can still use the form resize event:

Code: Select all

Private Sub Form_Load()
  TChart1.Align = vbAlignNone
End Sub

Private Sub Form_Resize()
  TChart1.Height = Form1.ScaleHeight
  TChart1.Width = Form1.ScaleWidth
  TChart1.Left = 0
  TChart1.Top = 0
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Auto Size property

Post by JAV » Mon Jul 09, 2012 5:19 pm

What are the specific command line to do what is showed in the pictures attached?
We want that our chart adjusts to the window automatically. So we need to program the "yes" check in the option Auto Size.
Thank you very much, regards,

JAV
Attachments
YES.jpg
YES.jpg (310.29 KiB) Viewed 27611 times
NO.jpg
NO.jpg (244.81 KiB) Viewed 27613 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Auto Size property

Post by Yeray » Tue Jul 10, 2012 2:18 pm

Hi JAV,

Isn't this the same we discussed here?
http://www.teechart.net/support/viewtop ... ign#p57816
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JAV
Newbie
Newbie
Posts: 65
Joined: Thu May 12, 2011 12:00 am

Re: Auto Size property

Post by JAV » Tue Jul 10, 2012 3:43 pm

Hi Yeray,

ok you caught us!

Effectively it is the same discussion! And it is because we still haven't solved the problem: Our IDE works the same as VB6, we have maximized the frame and with resize event we've maximized the activeX, it means, we adjusted the ActiveX to our frame, but the image looks truncated, as we showed in the previous post.
Please, tell us something different, we've already tried every instruction you gave before.
Regards,
Attachments
grafico truncado.jpg
grafico truncado.jpg (78.18 KiB) Viewed 27570 times

Post Reply