Page 1 of 1

Tool Data Table

Posted: Tue Oct 13, 2009 8:53 am
by 10050873
Hello,

I have problem with DataTable

Here are the pictures:
http://www.cijoint.fr/cjlink.php?file=c ... th66PH.jpg
http://www.cijoint.fr/cjlink.php?file=c ... DXAunS.jpg

With the datatable there is no mars month.

I don't understand why :oops:

Thanks for help

Re: Tool Data Table

Posted: Tue Oct 13, 2009 2:36 pm
by narcis
Hi Calou,

I could reproduce this one. Basically TDataTableTool requires more space to plot than axes labels and this issue depends on chart's width. I've added your request to the wish-list to be enhanced for future releases (TV52014476).

Re: Tool Data Table

Posted: Fri Nov 20, 2009 1:45 pm
by 10050873
Hello,

Do you know when the update version of Tchar will include this modification?

Thanks

Regards

Re: Tool Data Table

Posted: Fri Nov 20, 2009 3:38 pm
by yeray
Hi Calou,

I'm afraid that I can't tell you a date for this to be enhanced right now. It probably involves all the labels calculations.
Note that deactivating the tool and resizing the form to be smaller, there is a point where some axes labels are also hidden to avoid overlapping. The difference with the datatable tool active is that an extra margin is added at the left side to draw the series titles in the tool.
While it isn't enhanced, you could remove this margin:

Code: Select all

if ChartTool1.Active then
    Chart1.MarginLeft:=0;
Or also you could restrict the chart size as in the following example:

Code: Select all

uses DateUtils;

procedure TForm4.FormCreate(Sender: TObject);
var i: Integer;
    dt: TDateTime;
    tmp: String;
begin
  Series1.XValues.DateTime:=true;
  Chart1.Axes.Bottom.DateTimeFormat:='mmm yy';

  for i := 1 to 12 do
  begin
    dt:=EncodeDate(2009, i, 1);
    DateTimeToString(tmp, 'mmm yy', dt);
    Series1.AddXY(dt, random, tmp);
    Series2.AddXY(dt, random);
  end;

  Chart1.MarginUnits:=muPixels;
end;

procedure TForm4.FormResize(Sender: TObject);
var i, tmpWidth: Integer;
begin
  tmpWidth:=Chart1.Canvas.TextWidth(Chart1[0].Name);
  for i:=0 to Chart1[0].Count-1 do
  begin
    tmpWidth:=tmpWidth+Chart1.Canvas.TextWidth(Chart1[0].Labels[i]);
  end;
    tmpWidth:=tmpWidth+Chart1.MarginLeft+Chart1.MarginRight+Chart1[0].Count*15;

  if (tmpWidth > Form4.Width) then
  begin
    Chart1.Align:=alNone;
    Chart1.Width:=tmpWidth;
  end
  else
    Chart1.Align:=alClient;
end;