Page 1 of 1
Functions and How to Stop using them ?
Posted: Sat Dec 27, 2003 2:22 am
by 9078641
I have a moving average function working (thanks Josep) .
Now when the export data is called there are two columns in the data file !
I just want the original and not the moving average data. !
How can I stop exporting the moving average data ?
I suspect it's a call is needed to turn off the moving average function, but the tutorial does not explain how to do that !
Thanks
Posted: Mon Dec 29, 2003 8:42 am
by Pep
Have you set the Series that you want to export using :
Code: Select all
VARIANT TheSeries;
TheSeries.vt=VT_I2;
TheSeries.intVal=0;
m_chart.GetExport().GetAsText().SetSeries(TheSeries);
m_chart.GetExport().GetAsText().SaveToFile("c:\\mydata.txt");
Josep LLuis Jorge
http://support.steema.com
OK... but... !
Posted: Mon Dec 29, 2003 4:07 pm
by 9078641
The code sample you gave works fine, however
I'm allowing the user to select the format using
m_Chart1.GetExport().ShowExport();
That still exports the raw data and the moving average data.
How do I force the ShowExport() dialog to only use the data I want it to use ?
Posted: Mon Dec 29, 2003 4:24 pm
by Chris
Hi -
The code sample you gave works fine, however
I'm allowing the user to select the format using
m_Chart1.GetExport().ShowExport();
That still exports the raw data and the moving average data.
How do I force the ShowExport() dialog to only use the data I want it to use ?
You could remove the unwanted data (series) from the chart before calling IExport.ShowExport, e.g. (sorry for the VB code, but the TeeChart objects, properties, methods and events are identical in VC++):
Code: Select all
Private Sub Command1_Click()
With TChart1
.RemoveSeries 1
.Export.ShowExport
.AddSeries scLine
.Series(1).DataSource = "Series0"
.Series(1).SetFunction (tfMovavg)
.Series(1).FunctionType.Period = 1
End With
End Sub
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scCandle
.Series(0).FillSampleValues 20
.AddSeries scLine
.Series(1).DataSource = "Series0"
.Series(1).SetFunction (tfMovavg)
.Series(1).FunctionType.Period = 1
End With
End Sub
VB and V++ do not use the same methods...
Posted: Tue Dec 30, 2003 5:25 am
by 9078641
VB code
With TChart1
.RemoveSeries 1
.Export.ShowExport
....
I think it's something like
m_Chart1.Series(1).RemoveSeries();
Does not compile there is no function RemoveSeries();
I hate VB it sucks...
Posted: Tue Dec 30, 2003 6:33 am
by Marjan
Or you could simply set series/function ParentChart property to null. In effect, doing the same as RemoveSeries.
Would be nice if....
Posted: Tue Dec 30, 2003 11:10 am
by 9078641
series/function ParentChart property to null
Sounds like a real elegant way to do this...
I've tried just about every "hint" in the VC IDE but found nothing that looks like ParentChart...