Chart possible with Teechart?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Chart possible with Teechart?

Post by vinc64 » Fri Jul 06, 2018 9:07 am

I have set the following code but the function never gets called, is there an alternative?

Chart1.OnGetAxisLabel := Chart1GetAxisLabel;

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

Re: Chart possible with Teechart?

Post by Yeray » Mon Jul 09, 2018 7:02 am

Hello,

As soon as there's a series with data in the chart, it should be called. 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

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Chart possible with Teechart?

Post by vinc64 » Sun Jul 22, 2018 2:51 pm

Apologies for the late reply (was away for 2 weeks). I tried it out in a smaller program and the event-handler is called, hence must be a problem in my code.

Thanks for all the help.

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

Re: Chart possible with Teechart?

Post by Yeray » Mon Jul 23, 2018 7:18 am

Hello,

Sorry, I forgot to mention the OnGetAxisLabel isn't fired for an axis when you set it with custom labels. In this case you already control what texts are drawn and at what positions so you shouldn't need the event.
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

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Chart possible with Teechart?

Post by vinc64 » Mon Jul 23, 2018 8:06 am

Thanks for the additional feedback.

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Chart possible with Teechart?

Post by vinc64 » Thu Aug 02, 2018 9:19 am

For the text being shown in a shape, is there a way to wrap it in case it doesn't fit into a rectangle?

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

Re: Chart possible with Teechart?

Post by Yeray » Tue Aug 14, 2018 10:47 am

Hello,

Instead of formatting the texts with sLineBreak as I do at GetText function, you could use wraptext function once the chart has been drawn. Ie, at the end of your FormCreate:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var textW, shapeW: Integer;
begin
  //...
  Chart1.Draw;

  for i:=0 to Chart1.SeriesCount-1 do
    with Chart1[i] as TChartShape do
    begin
      Chart1.Canvas.AssignFont3D(Font);
      textW:=Chart1.Canvas.TextWidth(Text.Text);
      shapeW:=Bounds.Right-Bounds.Left;
      if textW>shapeW then
      begin
        charW:=Chart1.Canvas.TextWidth('W');
        Text.Text:=WrapText(Text.Text, shapeW div charW);
      end;
    end;

  Chart1.Draw;
end;
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

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Chart possible with Teechart?

Post by vinc64 » Thu Aug 16, 2018 12:23 pm

Thanks for the additional help.

Post Reply