Problems with series in a for/next structure
Problems with series in a for/next structure
A couple of probably stupid questions with obvious answers but... sorry guys, not for me. Can anybody help me?
I need to create and delete series in run time with a number of them dynamically changing with the results of some calculations in VB.NET but I am having problems. My idea was using a for/next structure but something does not work. How can I create am array or collection of seriex with an index? Same to delete themand referto them by that index.
I am trying to change as well the format of all the series in a chart using a For/next structure in Vb.NET but although one by one referring to the name I have no problem using something like: "Polar1.Pointer.Visible = False" series by series I seem unable to find how to do it referign to the each series with an index. Any ideas?
Thanks
I need to create and delete series in run time with a number of them dynamically changing with the results of some calculations in VB.NET but I am having problems. My idea was using a for/next structure but something does not work. How can I create am array or collection of seriex with an index? Same to delete themand referto them by that index.
I am trying to change as well the format of all the series in a chart using a For/next structure in Vb.NET but although one by one referring to the name I have no problem using something like: "Polar1.Pointer.Visible = False" series by series I seem unable to find how to do it referign to the each series with an index. Any ideas?
Thanks
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi ..
Try:
TChart1.Series.RemoveAt(2)
and
TChart1.Series.Add(New Steema.TeeChart.Styles.Line)
Try:
For Each s As Steema.TeeChart.Styles.Series In TChart1.Series
s.FillSampleValues(10)
Next
I need to create and delete series in run time with a number of them dynamically changing with the results of some calculations in VB.NET but I am having problems. My idea was using a for/next structure but something does not work. How can I create am array or collection of seriex with an index? Same to delete themand referto them by that index.
Try:
TChart1.Series.RemoveAt(2)
and
TChart1.Series.Add(New Steema.TeeChart.Styles.Line)
I am trying to change as well the format of all the series in a chart using a For/next structure in Vb.NET but although one by one referring to the name I have no problem using something like: "Polar1.Pointer.Visible = False" series by series I seem unable to find how to do it referign to the each series with an index. Any ideas?
Try:
For Each s As Steema.TeeChart.Styles.Series In TChart1.Series
s.FillSampleValues(10)
Next
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Thanks Chris, that solves one of the problems since I can deal with the series collection with a variable number of elements.
My next (maybe trivial but not for me) problem is asigning different properties to the series depending on the index of that element in the collection.
Series3D1.LinePen.Color = Color.Black
Series3D1.Pointer.visible= true
Work just fine but how do I make it work JUST for some known series from the whole collection that I can refer through its position?
My next (maybe trivial but not for me) problem is asigning different properties to the series depending on the index of that element in the collection.
Series3D1.LinePen.Color = Color.Black
Series3D1.Pointer.visible= true
Work just fine but how do I make it work JUST for some known series from the whole collection that I can refer through its position?
Hi Rokie,
TChart1(position).ColorEach = True
You can use :Work just fine but how do I make it work JUST for some known series from the whole collection that I can refer through its position?
TChart1(position).ColorEach = True
Pep Jorge
http://support.steema.com
http://support.steema.com
Sure Pep
TChart1.Series(position).ColorEach = True
works too and so I do in some cases but some other properties do not seem to be accesible that way so:
seriestitle.LinePen.Color = Color.Black
seriestitle.Pointer.Visible = false
where seriestitle is the name of the series works BUT:
Tchart1.series(position).LinePen.Color = Color.Black
Tchart1.series(position).Pointer.Visible = false
does not since I can not access the LinePen and Pointer properties that way.
So... that is my problem to make my runtime series creation and formatting fully automatic.
There has to be a pretty simple answer but I do not seem to be enough "object oriented" to see it.
Heeelp!!
TChart1.Series(position).ColorEach = True
works too and so I do in some cases but some other properties do not seem to be accesible that way so:
seriestitle.LinePen.Color = Color.Black
seriestitle.Pointer.Visible = false
where seriestitle is the name of the series works BUT:
Tchart1.series(position).LinePen.Color = Color.Black
Tchart1.series(position).Pointer.Visible = false
does not since I can not access the LinePen and Pointer properties that way.
So... that is my problem to make my runtime series creation and formatting fully automatic.
There has to be a pretty simple answer but I do not seem to be enough "object oriented" to see it.
Heeelp!!
Hi,
in that case you should use similar code to the following :
(tChart1.Series[position] as Steema.TeeChart.Styles.Line).Pointer.Visible = true;
in that case you should use similar code to the following :
(tChart1.Series[position] as Steema.TeeChart.Styles.Line).Pointer.Visible = true;
Pep Jorge
http://support.steema.com
http://support.steema.com
Well, from the next code
For position = 0 To 10
Tchart1.Series.Add(New Steema.TeeChart.Styles.Points3D)
Tchart1.Series(position).Title = "Series3D" & CStr(position)
Tchart1.Series(position).ColorEach = True
(Tchart1.Series(position) as Steema.TeeChart.Styles.Points3D ).pointer.visible=true
Next position
All works except
(Tchart1.Series(position) as Steema.TeeChart.Styles.Points3D ).pointer.visible=true
That gives a sintax error. It does not seem to accept the "as Steema.TeeChart......"
8O
For position = 0 To 10
Tchart1.Series.Add(New Steema.TeeChart.Styles.Points3D)
Tchart1.Series(position).Title = "Series3D" & CStr(position)
Tchart1.Series(position).ColorEach = True
(Tchart1.Series(position) as Steema.TeeChart.Styles.Points3D ).pointer.visible=true
Next position
All works except
(Tchart1.Series(position) as Steema.TeeChart.Styles.Points3D ).pointer.visible=true
That gives a sintax error. It does not seem to accept the "as Steema.TeeChart......"
8O
Hi,
yes, because this code is to be used unde C#, in VB you must do :
yes, because this code is to be used unde C#, in VB you must do :
Code: Select all
For position = 0 To 10
TChart1.Series.Add(New Steema.TeeChart.Styles.Points3D)
TChart1.Series(position).Title = "Series3D" & CStr(position)
TChart1.Series(position).ColorEach = True
TChart1.Series(position).FillSampleValues(10)
CType(TChart1.Series(position), Steema.TeeChart.Styles.Points3D).Pointer.Visible = True
Next position
Pep Jorge
http://support.steema.com
http://support.steema.com