Vertical bar series question

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
vasile
Newbie
Newbie
Posts: 9
Joined: Thu Jun 22, 2006 12:00 am

Vertical bar series question

Post by vasile » Thu Jun 22, 2006 12:06 pm

Hello,

I have a chart with 2 vertical bar series. The series are not stacked.

The first serie's datasource has the values:

A, 100
B, 80
C, 50
D, 70

The second serie's datasource has the values:

C, 20
D, 30

Now when I display the chart, the values from the second serie are displayed over A and B but I want them to be displayed over C and D.

Is this possible?

Thanks,
Vasile

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 Jun 22, 2006 1:03 pm

Hi Vasile,

Yes, this is possible. To achieve that you should add XValues for the series too. Actually they are automatically added: 0, 1, 2, 3 for the first series and 0, 1 for the second series. So that the series are displayed as you want you should add 0, 1, 2, 3 for the first series and 2, 3 for the second series.
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

vasile
Newbie
Newbie
Posts: 9
Joined: Thu Jun 22, 2006 12:00 am

Post by vasile » Thu Jun 22, 2006 2:21 pm

Unfortunately I get those values from a database so I can't get 0,1,2,3,etc.
I only can get some ids in ascending order but they are not sequential (100,101,104,120 for example).

If I add :

100, A, 100
101, B, 80
104, C, 50
120, D, 70

and

104, C, 50
120, D, 70

it still doesn't work...

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 Jun 22, 2006 3:11 pm

Hi vasile,

It works fine for me here using:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  With Series1 do
  begin
    AddXY(100,100,'A',clTeeColor);
    AddXY(101,80,'B',clTeeColor);
    AddXY(104,50,'C',clTeeColor);
    AddXY(120,70,'D',clTeeColor);
    BarWidthPercent:=20;
    OffsetPercent:=-50;
  end;

  With Series2 do
  begin
    AddXY(104,50,'C',clTeeColor);
    AddXY(120,70,'D',clTeeColor);
    BarWidthPercent:=20;
    OffsetPercent:=50;
  end;
end;
So you should try to set up your datasource to populate the series like this.
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

vasile
Newbie
Newbie
Posts: 9
Joined: Thu Jun 22, 2006 12:00 am

Post by vasile » Thu Jun 22, 2006 3:52 pm

Thanks for the example.
It works fine now except one small thing: there is a gap between C and D bars - because of the ids (104 and 120), is it possible to display the bars at the same distance one from another?

I could have ids like 101,102,120, 1200, 5000, etc.

Thanks,
Vasile

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

Post by Narcís » Fri Jun 23, 2006 10:14 am

Hi Vasile,

I'm afraid this is not possible. You should manually read your database values and manually populate the chart ignoring the indexes. This way x values will be automatically added.

To avoid the first problem you reported here you should check if each series has a value for each index or not and populate series accordingly.
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

vasile
Newbie
Newbie
Posts: 9
Joined: Thu Jun 22, 2006 12:00 am

Post by vasile » Fri Jun 23, 2006 10:17 am

OK, thank you.

Post Reply