Page 1 of 1

Dates in bottom axis in regular intervals

Posted: Tue Jan 23, 2007 8:31 pm
by 9231980
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.

Posted: Wed Jan 24, 2007 8:45 am
by narcis
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;

Posted: Wed Jan 24, 2007 8:27 pm
by 9231980
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

Posted: Thu Jan 25, 2007 9:33 am
by narcis
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;

Posted: Fri Feb 02, 2007 1:49 pm
by 9231980
Hello,

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

Thanks.
Rob