Dates in bottom axis in regular intervals

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Rob
Newbie
Newbie
Posts: 11
Joined: Fri Apr 02, 2004 5:00 am
Contact:

Dates in bottom axis in regular intervals

Post by Rob » Tue Jan 23, 2007 8:31 pm

Hello,

On certain dates I measure a value.

I have 5 dates for my x axis. Every date has its value on the left axis.
Everything is displayed fine but the intervals between the dates are calculated and then displayed. I want them to be regular. That is, if the interval between the dates in days is 10, 20, 30 and 40 I want the visual distance equally devided in parts of 25.

How can I do this?

I use Tchart V5 pro.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 24, 2007 8:45 am

Hi Rob,

I'm not sure about what you are trying to achieve here but have you tried setting axes increment? For example:

Code: Select all

  Chart1.Axes.Bottom.Increment:=25;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Rob
Newbie
Newbie
Posts: 11
Joined: Fri Apr 02, 2004 5:00 am
Contact:

Post by Rob » Wed Jan 24, 2007 8:27 pm

Hello Narcis,

I'm sorry, I did not explain it properly. The intervals are just examples, the real intervals are random. If I have 10 dates I want all 10 of them evenly ditributed on the graph, not representing their place on a timeline. Furthermore, the bottom axis displays random dates (every first) instead of the real dates (the proper dates are in the Data)

Some more details: the graph is a horizontal line, in Series Datasource Label has TotalErrors (representing the counting), the X axis has Date, the Y axis had TotalErrors. See images

Image

Image

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jan 25, 2007 9:33 am

Hi Rob,

Thanks for the information.

To achieve what you request you should populate your series like in the code snippet below. Here points are evenly spaced because only Y values are added to the series, X values are automatically added and range from 0 to MyLine.Count-1. That's why points are evenly spaced. To have dates displayed in the bottom axis labels we just need to add them as labels for each point, instead of X values, and set series marks to display Y values.

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var MyLine: TLineSeries;
begin
  MyLine:=TLineSeries.Create(self);
  Chart1.AddSeries(MyLine);

  With MyLine do
  begin
    Marks.Visible:=true;
    Marks.Style:=smsValue;

    Add(17, '14-5-05');
    Add(16, '9-7-05');
    Add(27, '3-9-05');
    Add(22, '11-9-05');
    Add(16, '29-10-05');
    Add(14, '22-12-05');
    Add(17, '23-2-06');
    Add(16, '19-3-06');
    Add(24, '20-4-06');
    Add(16, '14-7-06');
  end;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Rob
Newbie
Newbie
Posts: 11
Joined: Fri Apr 02, 2004 5:00 am
Contact:

Post by Rob » Fri Feb 02, 2007 1:49 pm

Hello,

thanks for the solution. We were hinted in the right direction and we solved the problem.

Thanks.
Rob

Post Reply