Can I only export active series to a text file.
-
- Newbie
- Posts: 9
- Joined: Tue Jun 10, 2008 12:00 am
Can I only export active series to a text file.
Hello,
I'm using the TSeriesDataText to export the data to a text (csv) file. The user can activate and de-activate the series and wants only the active series to be exported.
I noticed that all the series (active and de-active) are exported to the text file.
Is there a way to only export the active series.
Thanks in advance.
Marcel
I'm using the TSeriesDataText to export the data to a text (csv) file. The user can activate and de-activate the series and wants only the active series to be exported.
I noticed that all the series (active and de-active) are exported to the text file.
Is there a way to only export the active series.
Thanks in advance.
Marcel
Re: Can I only export active series to a text file.
Hi Marcel,
I'm afraid not. However you can always do you own exportation method.MarcelIbis wrote:Is there a way to only export the active series.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Tue Jun 10, 2008 12:00 am
Re: Can I only export active series to a text file.
Hello Yeray,
Thanks for your reply.
I noticed that in the TChartEditor component you have the oportunity to select all sereies or select one serie (see tab Export, Data).
Can this code not be used to add only the active series to the TSeriesDataText component?
If yes, do you have an example how to add series to the TSeriesData component?
I noticed also that the help file Tchart8.hlp is (very) old. Is there a new version available?
Thanks in advance.
Marcel
Thanks for your reply.
I noticed that in the TChartEditor component you have the oportunity to select all sereies or select one serie (see tab Export, Data).
Can this code not be used to add only the active series to the TSeriesDataText component?
If yes, do you have an example how to add series to the TSeriesData component?
I noticed also that the help file Tchart8.hlp is (very) old. Is there a new version available?
Thanks in advance.
Marcel
Re: Can I only export active series to a text file.
Hi Marcel,
Changing the code above for this works as you wish:
But applying this change would break the backwards compatibility. So we should probably add a boolean to control if the Chart[t].Active should be considered or not (not by default, as always).
I've added it to the wish list.
I'm afraid not. This is how it's made in TeeStore:MarcelIbis wrote:I noticed that in the TChartEditor component you have the oportunity to select all sereies or select one serie (see tab Export, Data).
Can this code not be used to add only the active series to the TSeriesDataText component?
Code: Select all
if Assigned(Series) then
DoSeries(Series)
else
for t:=0 to Chart.SeriesCount-1 do
DoSeries(Chart[t]);
Code: Select all
if Assigned(Series) then
DoSeries(Series)
else
for t:=0 to Chart.SeriesCount-1 do
if Chart[t].Active then DoSeries(Chart[t]);
I've added it to the wish list.
Do you see this file in an actual installation of TeeChart VCL v2012.06? I can only find a TeeChart2012.hlp in the Docs folder into the TeeChart installation.MarcelIbis wrote:I noticed also that the help file Tchart8.hlp is (very) old. Is there a new version available?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Can I only export active series to a text file.
Hi Marcel,
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.
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.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Tue Jun 10, 2008 12:00 am
Re: Can I only export active series to a text file.
Hello Yeray
Thank you for your suggestions to improve the export function.
For the time being I use the following workarround:
I delete the non active series before the export as shown below.
Than create the series again.
for i := Chart.SeriesList.Count -1 downto 0 do begin
if not Chart.Series.Active then
Chart.Series.Free;
end;
ExcelData := TSeriesDataText.Create(Chart, nil);
try
ExcelData.TextDelimiter := ';';
ExcelData.IncludeLabels := True;
ExcelData.IncludeHeader := True;
ExcelData.ValueFormat := '0.000 E+0';
ExcelData.SaveToFile(Datafile);
finally
ExcelData.Free;
end;
MakeSeries.
Regards,
Marcel
Thank you for your suggestions to improve the export function.
For the time being I use the following workarround:
I delete the non active series before the export as shown below.
Than create the series again.
for i := Chart.SeriesList.Count -1 downto 0 do begin
if not Chart.Series.Active then
Chart.Series.Free;
end;
ExcelData := TSeriesDataText.Create(Chart, nil);
try
ExcelData.TextDelimiter := ';';
ExcelData.IncludeLabels := True;
ExcelData.IncludeHeader := True;
ExcelData.ValueFormat := '0.000 E+0';
ExcelData.SaveToFile(Datafile);
finally
ExcelData.Free;
end;
MakeSeries.
Regards,
Marcel
Re: Can I only export active series to a text file.
Hi Marcel,
Right. And instead of removing and recreating the inactive series, you could move them into a temporal list and restore them after exporting the series.
Here it is an example.
However, if you want the order of the series to be maintained, you should improve it.
Right. And instead of removing and recreating the inactive series, you could move them into a temporal list and restore them after exporting the series.
Here it is an example.
However, if you want the order of the series to be maintained, you should improve it.
Code: Select all
uses Series, TeeStore;
procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.CheckBoxes:=true;
for i:=0 to 5 do
with Chart1.AddSeries(TBarSeries) do
begin
Title:='Series nº' + IntToStr(i+1);
Color:=OperaPalette[i mod Length(OperaPalette)];
Marks.Style:=smsValue;
Active:=(i mod 2 = 0);
for j:=0 to 5 do
Add(random*75+25, 'Value nº ' + IntToStr(j+1));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ExportActiveSeries;
end;
procedure TForm1.ExportActiveSeries;
var i: Integer;
tmpSeriesList: TChartSeriesList;
begin
tmpSeriesList:=TChartSeriesList.Create;
for i:=Chart1.SeriesCount-1 downto 0 do
begin
if not Chart1[i].Active then
begin
tmpSeriesList.Add(Chart1[i]);
Chart1[i].ParentChart:=nil;
end;
end;
with TSeriesDataText.Create(Chart1) do
begin
IncludeHeader:=true;
IncludeLabels:=true;
ValueFormat:='0.000 E+0';
TextDelimiter:=';';
SaveToFile('C:\tmp\testExport.csv');
end;
for i:=tmpSeriesList.Count-1 downto 0 do
begin
tmpSeriesList[i].ParentChart:=Chart1;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Tue Jun 10, 2008 12:00 am
Re: Can I only export active series to a text file.
Hello Yeray
Your workarround works great.
Saves time to create and fill the series again!
One minor detail, I had to include the TeEngine unit in the uses clause for version 8.
Thanks for the grear service.
Regards,
Marcel
Your workarround works great.
Saves time to create and fill the series again!
One minor detail, I had to include the TeEngine unit in the uses clause for version 8.
Thanks for the grear service.
Regards,
Marcel
Re: Can I only export active series to a text file.
Hi Marcel,
I'm glad to hear it works and you like it!
I'm glad to hear it works and you like it!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Site Admin
- Posts: 83
- Joined: Wed Nov 12, 2003 5:00 am
- Location: Girona, Catalonia
- Contact:
Re: Can I only export active series to a text file.
A new property in TSeriesData class has been introduced to allow exporting only a selected list of Series.
http://bugs.teechart.net/show_bug.cgi?id=243
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;
http://bugs.teechart.net/show_bug.cgi?id=243
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;
-
- Newbie
- Posts: 9
- Joined: Tue Jun 10, 2008 12:00 am
Re: Can I only export active series to a text file.
Hello David,
Great! Thanks for this update.
Could every wish of me being solved this way.
In which version is this implemented?
Regards,
Marcel Horsthuis.
Great! Thanks for this update.
Could every wish of me being solved this way.
In which version is this implemented?
Regards,
Marcel Horsthuis.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Can I only export active series to a text file.
Hi Marcel,
Not a public version yet but the next maintenance release. It will be announced in this forum and other Steema Software channels as well.MarcelIbis wrote: In which version is this implemented?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |