![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | [TV52016283] There is a customer who would like to export the series data to a csv... | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | yeray alonso <yeray> |
| Component: | Export | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | david |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
This wish has been implemented, at the base class TSeriesData (TeeStore.pas unit), so all derived export format classes now have a new property (an array of Series) to filter which Series should be exported. This applies to TSeriesDataText (txt, csv), TSeriesDataXML (xml), TSeriesDataHTML (html <table>), TSeriesDataXLS (Excel) and TSeriesDataJSON (json). Usage example: uses TeeStore; procedure TForm1.FormCreate(Sender: TObject); var data : TSeriesDataText; begin data:=TSeriesDataText.Create(Chart1); data.IncludeHeader:=True; data.SeriesList.Clear; // Add only the Series you want to export: data.SeriesList.Add(Series3); data.SeriesList.Add(Series5); data.SeriesList.Add(Series6); Memo1.Text:=data.AsString; data.Free; end; |
There is a customer who would like to export the series data to a csv, but only for the active series. I see 2 Options (second more flexible): Option1: We could add a new boolean (ie AllSeries) to set if all the series should be considered or only the active (all by default, to preserve backwards compatibility). In TeeStore.pas, in the TSeriesDataText.PointToString function the following code is executed: if Assigned(Series) then DoSeries(Series) else for t:=0 to Chart.SeriesCount-1 do DoSeries(Chart[t]); We could modify it for the following: if Assigned(Series) then DoSeries(Series) else for t:=0 to Chart.SeriesCount-1 do if AllSeries or Chart[t].Active then DoSeries(Chart[t]); There is at least another place where we should add this extra verification. The Header function is a nested function into TSeriesDataText.AsString function (still in TeeStore.pas). At the end, it says: if Assigned(Series) then result:=result+HeaderSeries(Series) else if Chart.SeriesCount>0 then begin result:=result+HeaderSeries(Chart[0]); for t:=1 to Chart.SeriesCount-1 do result:=result+TextDelimiter+HeaderSeries(Chart[t]); end; So we should modify it to also add the header only when needed: if Assigned(Series) then result:=result+HeaderSeries(Series) else if Chart.SeriesCount>0 then begin if AllSeries or Chart[0].Active then result:=result+HeaderSeries(Chart[0])+TextDelimiter; for t:=1 to Chart.SeriesCount-1 do if AllSeries or Chart[t].Active then result:=result+HeaderSeries(Chart[t])+TextDelimiter; end; ----- Option2: Alternativelly, we could make the Series property in TSeriesDataText to accept an array of series. This would allow the user to export only the desired series. This would be more flexible. http://www.teechart.net/support/viewtopic.php?f=3&t=13447&p=58855#p58855 [created:2012-07-31T11:15:50.000+01:00 reported by:yeray@steema.com reported in version:2012.06.120613 (TeeChart VCL)]