Page 1 of 1

How to export selected series only

Posted: Mon Jun 19, 2006 8:54 am
by 9529132
Hi,

There are many series in one chart and when exporting to xls or text file, I only need part of them. How can I define which sereis are to be exported?

Thank you.
David

Posted: Mon Jun 19, 2006 9:17 am
by narcis
Hi David,

You can use something like this:

Code: Select all

    TChart1.Export.asXLS.Series = 0

Posted: Mon Jun 19, 2006 9:26 am
by 9529132
Hi, Narcís,

Still the old problem. How to do it in VC++? Would you please provide the C++ code? Thank you very much!

BTW, would you please help me with this question I asked?
http://www.teechart.net/support/viewtopic.php?t=4154

David

Posted: Mon Jun 19, 2006 9:39 am
by 9529132
Hi, Narcís,

I figured out how to do it in VC++, but it seems this method can only export one sereis. What if I want to export 2 or more series among 10 series?

David

Posted: Mon Jun 19, 2006 10:33 am
by narcis
Hi David,

You can only do this exporting each series in a different file, repeating the process for each series. Otherwise you can only export one or all series in a chart.

BTW: I'll add your request to our wish-list to be considered for inclusion in future releases.

Posted: Mon Jun 19, 2006 10:44 am
by 9529132
Thanks!

Re: How to export selected series only

Posted: Mon Oct 14, 2013 10:53 pm
by 15666411
Did this feature ever make it into TChart, i.e., can we export a series subset as a text file?

Thanks,

Re: How to export selected series only

Posted: Tue Oct 15, 2013 11:56 am
by yeray
Hi,

I'm afraid not. However I think you could implement a method to do that. This method could clone the chart to a hidden chart; it could remove the unwanted series from this hidden chart and export that chart. Something like this:

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False

  Dim i As Integer
  For i = 0 To 2
    TChart1.AddSeries scBar
    TChart1.Series(i).FillSampleValues
  Next i
  
  tmpChart.Visible = False
End Sub

Private Sub ExportXMLSeries(ByRef ser() As Integer)
  tmpChart.Import.LoadFromStream TChart1.Export.asNative.SaveToStream(True)
  
  Dim i, j As Integer
  Dim found As Boolean
  For i = tmpChart.SeriesCount - 1 To 0 Step -1
    found = False
    For j = 0 To UBound(ser) - 1
      If i = ser(j) Then
        found = True
      End If
    Next j
    If Not found Then
      tmpChart.RemoveSeries i
    End If
  Next i
  
  tmpChart.Export.asXML.SaveToFile "C:\tmp\MyXMLChart.xml"
End Sub

Private Sub Command1_Click()
  Dim seriesSet(2) As Integer
  seriesSet(0) = 0
  seriesSet(1) = 2
  
  ExportXMLSeries seriesSet
End Sub

Re: How to export selected series only

Posted: Mon Oct 28, 2013 10:33 pm
by 15666411
Thanks Yeray. That worked. I cloned the chart and removed the unwanted series from the clone, then exported. I was actually using .NET; the existing forum thread happened to be in ActiveX.