Page 2 of 2

Re: Chart possible with Teechart?

Posted: Fri Jul 06, 2018 9:07 am
by 10551566
I have set the following code but the function never gets called, is there an alternative?

Chart1.OnGetAxisLabel := Chart1GetAxisLabel;

Re: Chart possible with Teechart?

Posted: Mon Jul 09, 2018 7:02 am
by yeray
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.

Re: Chart possible with Teechart?

Posted: Sun Jul 22, 2018 2:51 pm
by 10551566
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.

Re: Chart possible with Teechart?

Posted: Mon Jul 23, 2018 7:18 am
by yeray
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.

Re: Chart possible with Teechart?

Posted: Mon Jul 23, 2018 8:06 am
by 10551566
Thanks for the additional feedback.

Re: Chart possible with Teechart?

Posted: Thu Aug 02, 2018 9:19 am
by 10551566
For the text being shown in a shape, is there a way to wrap it in case it doesn't fit into a rectangle?

Re: Chart possible with Teechart?

Posted: Tue Aug 14, 2018 10:47 am
by yeray
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;

Re: Chart possible with Teechart?

Posted: Thu Aug 16, 2018 12:23 pm
by 10551566
Thanks for the additional help.