Top Axis with Gant graphic

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Top Axis with Gant graphic

Post by viper » Mon Jan 11, 2016 8:42 am

Hello

I have attached a PDF, that shows the acutal print out of my gant graphic.

The bottom axis shows the date of the gant data. I try to show also the top axis with the week number of the year, assigned to the gant data. But i don't have any idea where i have to start with programming.

Also does i have the problem, that the text are not realy clear (pixels) at the print out and the allignment are should be left!

May somebody have my a hint.

Thanks
Gregor
Attachments
Aufnahme3.jpg
Aufnahme3.jpg (367.23 KiB) Viewed 8144 times

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

Re: Top Axis with Gant graphic

Post by Yeray » Tue Jan 12, 2016 9:37 am

Hi Gregor,
viper wrote:The bottom axis shows the date of the gant data. I try to show also the top axis with the week number of the year, assigned to the gant data. But i don't have any idea where i have to start with programming.
You should assign both axes to your series to make them visible.

Code: Select all

Series1.HorizAxis:=aBothHorizAxis;
Since there's no formatdatetime to show the week number of the year, you should use OnGetAxisLabel event to format the string manually. Ie:

Code: Select all

uses DateUtils;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.HorizAxis:=aBothHorizAxis;

  Chart1.Axes.Top.Increment:=DateTimeStep[dtOneWeek];
  Chart1.OnGetAxisLabel:=Chart1GetAxisLabel;
end;

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
  ValueIndex: Integer; var LabelText: string);
var tmpDate: TDateTime;
begin
  if (Sender = Chart1.Axes.Top) and (LabelText<>'') then
  begin
    tmpDate:=StrToDateTime(LabelText);
    LabelText:=IntToStr(WeekOf(tmpDate));
  end;
end;
viper wrote:Also does i have the problem, that the text are not realy clear (pixels) at the print out and the allignment are should be left!
We should differentiate:

- Printing resolution. Take a look at the printing better article here.

- Alignment. I'm not sure to understand what doesn't look as you'd expect. Could you please expand? Note an sscce helps to easily understand and reproduce the problems.
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

viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Re: Top Axis with Gant graphic

Post by viper » Wed Jan 13, 2016 7:35 am

Hello Yeray

Thank you for your fast respons and answer. I could solve my problem with the calendar number and printout resolution.

Now it just left the problem with the alligment of the text (Gant) at the left side.

When you take a look at my printout example, the text for the gant are center alligned. But i try to allign it left, but i can't find the responsible property.

Best Regards
Gregor

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

Re: Top Axis with Gant graphic

Post by Yeray » Wed Jan 13, 2016 10:08 am

Hi Gregor,
viper wrote:Thank you for your fast respons and answer. I could solve my problem with the calendar number and printout resolution.
I'm glad to hear you found how to make it work as you wish.
viper wrote:Now it just left the problem with the alligment of the text (Gant) at the left side.

When you take a look at my printout example, the text for the gant are center alligned. But i try to allign it left, but i can't find the responsible property.
Try with this:

Code: Select all

Chart1.Axes.Left.Items.Format.TextAlignment:=taLeftJustify;
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

viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Re: Top Axis with Gant graphic

Post by viper » Wed Jan 13, 2016 2:42 pm

Hello Yeray

Thanks, you Tip works perfect.

Gregor

Post Reply