Hi,
In my cahrt I have two series. Series 0 and Series 1.
Series 0 is a line chart and series 1 is bar chart.
Series 1 is based on series 0 data and should be sorted in ascending or decending order on the fly by clicking on an option button "decending/ascending" by the end user.
How do I do this by code.
Thanks
Tom.K
How to Sort Series
Hi Tom,
you can find one example which shows how to do this into the Features Demo project (included with the TeeChart Pro installation), just do a search for "Sort" and you will find an example named "Sort Order".
you can find one example which shows how to do this into the Features Demo project (included with the TeeChart Pro installation), just do a search for "Sort" and you will find an example named "Sort Order".
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi,
I was aware of this sample and have tested it and it is working when you are using database connectivity on your series. My series 1 is not database connected its source is series 0 which is database connected. Bassed on the series 0 data I do some calculations and
display the output in series 1 and then sort it (not label sort).
Series 1 is a bar chart.
Using this sample sort method to series 1 will not work. It only works for database connections.
I am using TChartax 7.005.
Regards,
Tom.K
I was aware of this sample and have tested it and it is working when you are using database connectivity on your series. My series 1 is not database connected its source is series 0 which is database connected. Bassed on the series 0 data I do some calculations and
display the output in series 1 and then sort it (not label sort).
Series 1 is a bar chart.
Using this sample sort method to series 1 will not work. It only works for database connections.
I am using TChartax 7.005.
Regards,
Tom.K
Hi Tom,
you should be able to sort the Bars without having a database connectivity, using for example the following code :
you should be able to sort the Bars without having a database connectivity, using for example the following code :
Code: Select all
Private Sub Command1_Click()
With TChart1
.Series(0).XValues.Order = loDescending
.Series(0).XValues.Sort
.Series(0).XValues.FillSequence
.Repaint
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Josep,
Thanks for your prompt reply. I created a simple TChart project with a bar series and used fillsamplevalues to populate the chart. I then added command button 1 and pasted your code behing it.
When I ran the charet and clicked command button 1, all it did was reverse the series order it did not sort the data in acending or decening order, which is what I am after.
Please, I am desperate surely this is a simple procedure. How do I accomplish the series sorting?
Kind regards,
Tom.K
Thanks for your prompt reply. I created a simple TChart project with a bar series and used fillsamplevalues to populate the chart. I then added command button 1 and pasted your code behing it.
When I ran the charet and clicked command button 1, all it did was reverse the series order it did not sort the data in acending or decening order, which is what I am after.
Please, I am desperate surely this is a simple procedure. How do I accomplish the series sorting?
Kind regards,
Tom.K
Hi Tom,
sorry, I mistake me in the code. The following code works fine here :
sorry, I mistake me in the code. The following code works fine here :
Code: Select all
Private Sub Command1_Click()
With TChart1
.Series(0).YValues.Order = loAscending
.Series(0).YValues.Sort
.Series(0).XValues.FillSequence
.Repaint
End With
End Sub
Private Sub Form_Load()
TChart1.Series(0).FillSampleValues (5)
With TChart1
.Series(0).XValues.Order = loNone
.Series(0).YValues.Order = loNone
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com