Adding points at runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Timeware AG
Newbie
Newbie
Posts: 10
Joined: Thu Nov 06, 2003 5:00 am
Location: Switzerland
Contact:

Adding points at runtime

Post by Timeware AG » Mon Jan 19, 2004 3:51 pm

I need to create a grouped bar diagram (MultiBar := mbSide) at runtime. This works fine as long as all groups have the same values.

For example, with this values all works fine, if I want to show these values grouped by month:

Product code Month Quantity produced
10 Jan 300
10 Feb 325
10 Mar 287
12 Jan 175
12 Feb 223
12 Mar 241
14 Jan 461
14 Feb 470
14 Mar 455


But if I have not for all months all products it won't work. Therefore with this values it won't work (missing product 12 in february):

Product code Month Quantity produced
10 Jan 300
10 Feb 325
10 Mar 287
12 Jan 175
12 Mar 241
14 Jan 461
14 Feb 470
14 Mar 455

I use the following code to create the chart:

with Chart.AddSeries(TBarSeries) do begin
Title := ProductCode
AddXY(GroupSortOrder, Quantity, Month);
end;

Where GroupSortOrder is a unique integer value for each month

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Jan 20, 2004 7:46 am

Hi.
But if I have not for all months all products it won't work.
Correct. In your case the easiest solution is to use AddNullXY method for missing data. This way you'll ensure data for all products for all months and the grouping/stacking will work correctly (again). So, first do a check if some points are missing and if they are, use AddNullXY method to add missing data as "null" points.
Marjan Slatinek,
http://www.steema.com

Post Reply