ExchangeSeries not working with dbchart?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

ExchangeSeries not working with dbchart?

Post by Steffen » Sun Nov 08, 2009 10:47 pm

I tried bringing Series2 to front with ExchangeSeries() in a 2 series dbchart but with no effect.
I tried both variations: dbChart1.ExchangeSeries(series1,series2) and dbChart1.ExchangeSeries(Series2,Series1);

Could it be that ExchangeSeries() works only for tchart and not for tdbchart?

Brgds
Steffen;

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

Re: ExchangeSeries not working with dbchart?

Post by Yeray » Mon Nov 09, 2009 2:44 pm

Hi Steffen,

Could you please try the following code in an empty DBChart? It seems to work fine here:

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBChart1.AddSeries(TLineSeries.Create(self));
  DBChart1.AddSeries(TLineSeries.Create(self));
  DBChart1[0].FillSampleValues(25);
  DBChart1[1].FillSampleValues(25);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBChart1.ExchangeSeries(DBChart1[0], DBChart1[1]);
end;
I fit doesn't work for you, could you please tell us what exact TeeChart version are you using?
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: ExchangeSeries not working with dbchart?

Post by Steffen » Mon Nov 16, 2009 12:14 pm

Dear Yeray,

thanks for the demo app. It helped my understand that the nature of my problem is that I have 2 cross tab series (a bar and a point one) which need to be exchanged (the points should be in front). Each cross tab generates a multitude of series and the indexes of the two kinds of series are mixed.

Now, I can identify the two matching pairs of series by their title (dbchart1.Series.Title) and exchange them pair by pair in a for next loop.
Anyhow, I'd rather prefer to avoid this. I tried deleting both crosstab-series and create them in an opposite order but this failed.

Can you imagine a smoother?

Best regards,
Steffen

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

Re: ExchangeSeries not working with dbchart?

Post by Yeray » Mon Nov 16, 2009 1:57 pm

Hi Steffen,

You can use two variables to point to your bar and point series respectively. With that, you won't need to loop into your chart's series list. For example:

Code: Select all

uses series;

var bar1: TBarSeries;
    points1: TPointSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  bar1:=Chart1.AddSeries(TBarSeries.Create(self)) as TBarSeries;
  points1:=Chart1.AddSeries(TPointSeries.Create(self)) as TPointSeries;
  bar1.FillSampleValues(25);
  points1.FillSampleValues(25);

  Chart1.AddSeries(TLineSeries.Create(self));
  Chart1.AddSeries(TLineSeries.Create(self));
  Chart1[2].FillSampleValues(25);
  Chart1[3].FillSampleValues(25);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.ExchangeSeries(bar1, points1);
end;
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: ExchangeSeries not working with dbchart?

Post by Steffen » Tue Nov 17, 2009 8:08 am

Dear Yeray,

that works nicely so far, thank you very much.

Still, I do not want to create series with .Addseries but in Object designer as all settings could be set easier.

So, I tried to assign:
bar1:=Series1 AS TBarSeries;
points1 := Series2 AS TPointSeries;

But with this, dbChart1.ExchangeSeries(bar1, points1) would again only exchange "series1" against "series2" not "series-set 1" against "series-set 2".

How would I adress a crosstab series-set instead of an individual series?
Does teechart make a difference between these two kinds of series at all?

Brgds.
Steffen

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

Re: ExchangeSeries not working with dbchart?

Post by Yeray » Tue Nov 17, 2009 10:32 am

Hi Steffen,

I think I don't understand what is your exact situation. Could you please send us a simple example project we can run as-is to reproduce the problem here?

Thanks in advance.
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

Post Reply