Sorting the Bars on a Barchart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Red77
Newbie
Newbie
Posts: 8
Joined: Mon Feb 14, 2005 5:00 am

Sorting the Bars on a Barchart

Post by Red77 » Wed Apr 20, 2005 8:30 pm

Hi,
(Im using Teechart through Digital Metaphors Report Builder.)

I have a barchart where the bars are sorted left to right from smallest bar to largest bar.
How do I change it so that I sort the bar names across the x-axis in their aplhabetical order?

Thanks

Red

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 Apr 21, 2005 9:25 am

Hi Red,

You can use:

Code: Select all

Series1.SortByLabels(loAscending);
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

Red77
Newbie
Newbie
Posts: 8
Joined: Mon Feb 14, 2005 5:00 am

Post by Red77 » Thu Apr 21, 2005 2:00 pm

Hi,

Thanks but this inst working.
In the code section the only procedure available for the DPTeeChart object is 'OnPrint'

When I enter
Series1.SortByLabels(loAscending);

The error messgae is
"Error:DPTeeChart1OnPrint, Line3: Undeclared indentifier: 'Series1'."

The series on my chart IS called Series1.
What might the problem be?

Thanks
Red

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

Post by Marjan » Thu Apr 21, 2005 2:20 pm

Hi.
The series on my chart IS called Series1.
Series Title? But what about IDE generated Name ? Check if Series1 is listed in the form IDE managed section list. If no, you can still reference series by it's position in your chart Series array. Example

Code: Select all

YourChart.Series[0].SortByLabels(loAscending); 
Marjan Slatinek,
http://www.steema.com

Red77
Newbie
Newbie
Posts: 8
Joined: Mon Feb 14, 2005 5:00 am

Post by Red77 » Thu Apr 21, 2005 2:35 pm

Hi,
By IDE generated name I guess you mean
'DPTeeChart1'?

Within my chart I have a series. Its called Series1.
Series1 is not listed as an object.

Using that code the error I now get is
"Expected '(' or '[' , but found 'Series' instead."

Thanks

Red

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 Apr 21, 2005 2:37 pm

Hi Red,

Then try using:

Code: Select all

DPTeeChart1[0].SortByLabels(loAscending);
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

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

Post by Marjan » Thu Apr 21, 2005 2:38 pm

Hi.

by IDE generated name I guess you mean
'DPTeeChart1'?
Precisely :) If this is the case then the following should work fine:

Code: Select all

DPTeeChart1.Series[0].SortByLabels(loAscending);
You could try a shorter version:

Code: Select all

DPTeeChart1[0].SortByLabels(loAscending);
Marjan Slatinek,
http://www.steema.com

Red77
Newbie
Newbie
Posts: 8
Joined: Mon Feb 14, 2005 5:00 am

Post by Red77 » Thu Apr 21, 2005 2:47 pm

Marjan,

I still get the same error for both codes

"Expected '(' or '[' , but found 'Series' instead."

????
Red

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

Post by Marjan » Thu Apr 21, 2005 6:01 pm

Hi.

Hm... I don't have RB installed on my machine so I'm not 100% sure what the class structure for RB chart is. Back in the old RB 7 days there was a TppChart.Chart class which allowed direct access to all TDBChart properties. Check if DPTeeChart has a .Chart (or similar) property. If yes, then all you must do is insert .Chart after the DPTeeChart1:

Code: Select all

DPTeeChart1.Chart.Series[0].SortByLabels(loAscending);
I think RB also has some nice examples about accessing TDBChart properties. Also, some clues might be available in Report Builder help files and tutorials.

If you still can't make it work, please send me your form dfm file (saved as text) + pas file so that I can see exactly what is created and how it's being accessed. You can send it to my "marjan at steema dot com" email address.
Marjan Slatinek,
http://www.steema.com

Red77
Newbie
Newbie
Posts: 8
Joined: Mon Feb 14, 2005 5:00 am

Post by Red77 » Thu Apr 21, 2005 6:56 pm

OK,
Im running RB 9.01.

I do not have the TppChart.Chart class.
I tried that code anyway. It did not work.

I do not have access to RB help or Teechart help modules unforturnately.
And I do not have access to the dfm or pas files.

So now, all I can do is email you a screen shot or my coding area, to see if you can figure anything.
Ill will email to you in a few minutes

Hvala,
Red

Post Reply