Page 1 of 1

Export part of the data?

Posted: Wed Jul 19, 2006 10:50 am
by 9529132
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

Posted: Mon Jul 24, 2006 1:04 am
by 9529132
Any suggestion?

Posted: Mon Jul 24, 2006 7:08 am
by Pep
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.

Posted: Mon Jul 24, 2006 8:26 am
by 9529132
Hi, Pep,

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

David

Posted: Mon Jul 31, 2006 9:44 am
by Pep
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

Posted: Mon Jul 31, 2006 10:06 am
by 9529132
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

Posted: Tue Aug 01, 2006 11:15 am
by Pep
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);
   }