Problem with Surface serie and datasource Recordset
Problem with Surface serie and datasource Recordset
Hello
i am using activeX 5.0.5.0.
I have a simple chart with one surface serie.
I am trying to fill serie with datas from a recordset but it does'nt work.
So i made a little example with an unconnected recordset and the problem
is the same. I can't see datas in my serie. The X and Y axis are settings correctly, but there is no Z axis.
Code is below.
Thanks for your help.
Regards
Set rs_ado = New ADODB.Recordset
Dim tabX(2) As Double
Dim tabY(2, 2) As Double
Dim tabZ(2) As Double
Dim i As Long
rs_ado.Fields.Append "FieldX", adDouble
rs_ado.Fields.Append "FieldZ", adDouble
rs_ado.Fields.Append "FieldY", adDouble
tabX(0) = 1
tabX(1) = 2
tabX(2) = 3
tabZ(0) = 90
tabZ(1) = 95
tabZ(2) = 100
tabY(0, 0) = 15
tabY(0, 1) = 35
tabY(0, 2) = 20
tabY(1, 0) = 10
tabY(1, 1) = 15
tabY(1, 2) = 5
tabY(2, 0) = 45
tabY(2, 1) = 60
tabY(2, 2) = 55
rs_ado.Open
For i = 0 To 2
For j = 0 To 2
rs_ado.AddNew
rs_ado.Fields(0) = tabX(i)
rs_ado.Fields(1) = tabZ(i)
rs_ado.Fields(2) = tabY(i, j)
rs_ado.Update
Next
Next
TChart1.Series(0).DataSource = rs_ado
TChart1.Series(0).asSurface.ZValues.ValueSource = "FieldZ"
TChart1.Series(0).XValues.ValueSource = "FieldX"
TChart1.Series(0).YValues.ValueSource = "FieldY"
i am using activeX 5.0.5.0.
I have a simple chart with one surface serie.
I am trying to fill serie with datas from a recordset but it does'nt work.
So i made a little example with an unconnected recordset and the problem
is the same. I can't see datas in my serie. The X and Y axis are settings correctly, but there is no Z axis.
Code is below.
Thanks for your help.
Regards
Set rs_ado = New ADODB.Recordset
Dim tabX(2) As Double
Dim tabY(2, 2) As Double
Dim tabZ(2) As Double
Dim i As Long
rs_ado.Fields.Append "FieldX", adDouble
rs_ado.Fields.Append "FieldZ", adDouble
rs_ado.Fields.Append "FieldY", adDouble
tabX(0) = 1
tabX(1) = 2
tabX(2) = 3
tabZ(0) = 90
tabZ(1) = 95
tabZ(2) = 100
tabY(0, 0) = 15
tabY(0, 1) = 35
tabY(0, 2) = 20
tabY(1, 0) = 10
tabY(1, 1) = 15
tabY(1, 2) = 5
tabY(2, 0) = 45
tabY(2, 1) = 60
tabY(2, 2) = 55
rs_ado.Open
For i = 0 To 2
For j = 0 To 2
rs_ado.AddNew
rs_ado.Fields(0) = tabX(i)
rs_ado.Fields(1) = tabZ(i)
rs_ado.Fields(2) = tabY(i, j)
rs_ado.Update
Next
Next
TChart1.Series(0).DataSource = rs_ado
TChart1.Series(0).asSurface.ZValues.ValueSource = "FieldZ"
TChart1.Series(0).XValues.ValueSource = "FieldX"
TChart1.Series(0).YValues.ValueSource = "FieldY"
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Roland,
Surface series need to be populated in a grid basis. X values determine rows, Z values columns and each cell value is determined by Y values.
You need to use IrregularGrid = True when X and Z values are not equidistant.
Surface series need to be populated in a grid basis. X values determine rows, Z values columns and each cell value is determined by Y values.
You need to use IrregularGrid = True when X and Z values are not equidistant.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Roland,
Could you please send us an example we can run "as-is" or some code so that we can reproduce the problem here?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Could you please send us an example we can run "as-is" or some code so that we can reproduce the problem here?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Hi Narcis.
I don't have access to news://www.steema.net/steema.public.attachments because of security firewall in my society.
But you can make a sample program easily.
You need 1 access database(i named "SteemaDB") with 1 table (i named "Steema"). The table contains 3 fields : Xvalue, Yvalue and Criteria
The data are following :
XValue YValue Criteria
1 1 Criteria1
2 2 Criteria1
3 3 Criteria1
4 4 Criteria1
5 5 Criteria1
6 12 Criteria2
7 14 Criteria2
8 16 Criteria2
9 18 Criteria2
10 20 Criteria2
You need 1 chart with 1 line serie and a command button in a form.
Then paste the following code :
Private Sub Command1_Click()
Dim MyConnection As ADODB.Connection
Dim ConnexionString As String
Dim rs_ado As ADODB.Recordset
Dim str_sql As String
Set rs_ado = New ADODB.Recordset
Set MyConnection = New ADODB.Connection
ConnexionString = "C:\Temp\SteemaDB.mdb"
With MyConnection
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" & ConnexionString & ";"
.Open
End With
str_sql = "Select XValue, YValue, Criteria from Steema"
rs_ado.Open str_sql, MyConnection, adOpenDynamic, adLockOptimistic
rs_ado.Filter = "Criteria='Criteria1'"
TChart1.Series(0).DataSource = rs_ado
TChart1.Series(0).XValues.ValueSource = "XValue"
TChart1.Series(0).YValues.ValueSource = "YValue"
end sub
So i have a recordset on wich i perform a filter based on Criteria field.
I would like to plot only the datas of the filtered recordset on my Chart.
But i see all the data.
Is there a way to force TChart to apply the filter?
Thanks a lot
Roland
I don't have access to news://www.steema.net/steema.public.attachments because of security firewall in my society.
But you can make a sample program easily.
You need 1 access database(i named "SteemaDB") with 1 table (i named "Steema"). The table contains 3 fields : Xvalue, Yvalue and Criteria
The data are following :
XValue YValue Criteria
1 1 Criteria1
2 2 Criteria1
3 3 Criteria1
4 4 Criteria1
5 5 Criteria1
6 12 Criteria2
7 14 Criteria2
8 16 Criteria2
9 18 Criteria2
10 20 Criteria2
You need 1 chart with 1 line serie and a command button in a form.
Then paste the following code :
Private Sub Command1_Click()
Dim MyConnection As ADODB.Connection
Dim ConnexionString As String
Dim rs_ado As ADODB.Recordset
Dim str_sql As String
Set rs_ado = New ADODB.Recordset
Set MyConnection = New ADODB.Connection
ConnexionString = "C:\Temp\SteemaDB.mdb"
With MyConnection
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" & ConnexionString & ";"
.Open
End With
str_sql = "Select XValue, YValue, Criteria from Steema"
rs_ado.Open str_sql, MyConnection, adOpenDynamic, adLockOptimistic
rs_ado.Filter = "Criteria='Criteria1'"
TChart1.Series(0).DataSource = rs_ado
TChart1.Series(0).XValues.ValueSource = "XValue"
TChart1.Series(0).YValues.ValueSource = "YValue"
end sub
So i have a recordset on wich i perform a filter based on Criteria field.
I would like to plot only the datas of the filtered recordset on my Chart.
But i see all the data.
Is there a way to force TChart to apply the filter?
Thanks a lot
Roland
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Roland,
Would you mind sending me this example project to the e-mail address I sent you in a forums private message?
Thanks in advance.
Would you mind sending me this example project to the e-mail address I sent you in a forums private message?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Roland,
I'm afraid this is not supported by TeeChart. However you can achieve the same functionality doing something as another customer suggested on this forums topic.
I'm afraid this is not supported by TeeChart. However you can achieve the same functionality doing something as another customer suggested on this forums topic.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Hi Narcis
i'm back
I have now a problem with the data in my surface serie.
The surface isn't drawing correctly. I have holes in my surface.
First i thought it was because the X value wasn't correctly filtered in ascending order when assigning them to the serie but i was in mistake.
and second question, how can i access to the label of the depth axis?
I am sending you the project because i don't have access to newsgroup.
Thanks
i'm back

I have now a problem with the data in my surface serie.
The surface isn't drawing correctly. I have holes in my surface.
First i thought it was because the X value wasn't correctly filtered in ascending order when assigning them to the serie but i was in mistake.
and second question, how can i access to the label of the depth axis?
I am sending you the project because i don't have access to newsgroup.
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Roland,
If you want your surface series to display holes you can have a look at the All Features\Welcome!\Chart Styles\Extended\Surface\With holes example in the TeeChart features demo. You'll find the demo at TeeChart's program group.
This is because your surface series is not populated properly. IrregularGrid indicates if X and Z values are equidistant or not but X and Z values should follow a regular pattern as would be:I have now a problem with the data in my surface serie.
The surface isn't drawing correctly. I have holes in my surface.
First i thought it was because the X value wasn't correctly filtered in ascending order when assigning them to the serie but i was in mistake.
Code: Select all
For X = 1 To 10
For z = 1 To 10
tmp = Cos(X / 10#) * Sin(z / 10#)
.Series(0).asSurface.AddXYZ X, tmp, z, "", clTeeColor
Next z
Next X
You can use the OnGetAxisLabel event and something like this:and second question, how can i access to the label of the depth axis?
Code: Select all
Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
If (Axis = 4) Then
LabelText = "Hello!"
End If
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |