Page 1 of 1

Sorting the Bars on a Barchart

Posted: Wed Apr 20, 2005 8:30 pm
by 9340972
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

Posted: Thu Apr 21, 2005 9:25 am
by narcis
Hi Red,

You can use:

Code: Select all

Series1.SortByLabels(loAscending);

Posted: Thu Apr 21, 2005 2:00 pm
by 9340972
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

Posted: Thu Apr 21, 2005 2:20 pm
by Marjan
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); 

Posted: Thu Apr 21, 2005 2:35 pm
by 9340972
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

Posted: Thu Apr 21, 2005 2:37 pm
by narcis
Hi Red,

Then try using:

Code: Select all

DPTeeChart1[0].SortByLabels(loAscending);

Posted: Thu Apr 21, 2005 2:38 pm
by Marjan
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);

Posted: Thu Apr 21, 2005 2:47 pm
by 9340972
Marjan,

I still get the same error for both codes

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

????
Red

Posted: Thu Apr 21, 2005 6:01 pm
by Marjan
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.

Posted: Thu Apr 21, 2005 6:56 pm
by 9340972
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