Functions and How to Stop using them ?

TeeChart for ActiveX, COM and ASP
Post Reply
hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

Functions and How to Stop using them ?

Post by hansw » Sat Dec 27, 2003 2:22 am

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 29, 2003 8:42 am

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

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

OK... but... !

Post by hansw » Mon Dec 29, 2003 4:07 pm

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 ?

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Dec 29, 2003 4:24 pm

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
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/

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

VB and V++ do not use the same methods...

Post by hansw » Tue Dec 30, 2003 5:25 am

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...

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Dec 30, 2003 6:33 am

Or you could simply set series/function ParentChart property to null. In effect, doing the same as RemoveSeries.
Marjan Slatinek,
http://www.steema.com

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

Would be nice if....

Post by hansw » Tue Dec 30, 2003 11:10 am

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...

Post Reply