Export part of the data?

TeeChart for ActiveX, COM and ASP
Post Reply
David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Export part of the data?

Post by David » Wed Jul 19, 2006 10:50 am

Hi,

If there are sereval series in a chart and I would like to export only part of them, say from point 20 to 100 out of 200 points. Is it possible to do it?

Thank you very much!
David

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Mon Jul 24, 2006 1:04 am

Any suggestion?

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

Post by Pep » Mon Jul 24, 2006 7:08 am

Hi David,

the only way I can think of is to create a temporary Chart with the Data you want to export (extracting them from the original Chart) and then do the export of this Chart.
There's not an option to do this automatically.

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Mon Jul 24, 2006 8:26 am

Hi, Pep,

Would you please provide some code how to do that? Add a chart with SetActive(FALSE)?

David

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

Post by Pep » Mon Jul 31, 2006 9:44 am

Hi David,

you could use similar code to the following :

Code: Select all

Private WithEvents tmpChartObj As TeeChart.TChart

Private Sub Command1_Click()
  Set tmpChartObj = CreateObject("TeeChart.TChart")
  With tmpChartObj
    .ClearChart
    .AddSeries (scLine)
    startpoint = 20
    endpoint = 100
    For i = startpoint To endpoint
      .Series(0).AddXY TChart1.Series(0).XValues.Value(i), TChart1.Series(0).YValues.Value(i), "", clTeeColor
    Next i
    .Export.asText.SaveToFile "c:\temp\chart.txt"
  End With
End Sub

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Mon Jul 31, 2006 10:06 am

Hi, Pep,

I am trying to translate your code into C++ code as below.

CTChart m_chart1;
m_chart1.CreateObject();
m_chart1.ClearChart();
m_chart1.AddSeries(scLine);
...

Did I translate it correctly? If I use the CreateObject(), do I still need to add a TChart object into the dialog?

Thank you very much!
David

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

Post by Pep » Tue Aug 01, 2006 11:15 am

Hi David,

I'm not very familiar with vc++ but you should be able to create it as other standard components. You could create both the original and the temporal used to export specific data at runtime. To create it and add it to the dialog you should use similar code to the following :

Code: Select all

   CRect m_Position;
   m_Position.left = 0;
   m_Position.top = 0;
   m_Position.right = 200;
   m_Position.bottom = 200;
   
   if (m_Chart.m_hWnd == NULL)
   {
      m_Chart.Create("TCHARTWINDOW",NULL,m_Position,this,1001);
   }

Post Reply