Hi,
I have a chart series1, it is defined as standard line in code as below,
Series1: TLineSeries;
It can be change to Bar (TBarSeries) during run-time. However, it is defined as line in code, so every time when program starts, Series1 always be a line, our customer wants to keep last settings, that is, if Series1 has been changed to bar,next time when the programs start, it will be a bar not line, how do i achieve this ? Thanks.
Daniel
Re: Save settings of series ?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Daniel,
To achieve that you should export your chart to a .tee file, native TeeChart template file. For more information on how to export TeeChart please read Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials at TeeChart's program group.
To achieve that you should export your chart to a .tee file, native TeeChart template file. For more information on how to export TeeChart please read Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials at TeeChart's program group.
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 |
Hi,
I have read tutorial #12 and also other related posts in this forum.
I include TeeEditPRO unit in my code. Below are bits of code, my question follows the code.
type
TMainForm = class(TForm)
....
series1 : TSeriesLine;
procedure MainForm.FormShow();
var
tmpChart:TCustomChart;
begin
DataChart.Free;
tmpChart:=TChart.Create(Self);
LoadChartfromFile(tmpChart,'cfg.tee');
DataChart := tmpChart as TChart;
DataChart.Parent:=Self;
end
procedure MainForm.FormClose();
begin
SaveChartToFile(DataChart, 'cfg.tee',False);
end;
Series1 is hard coded as TSeriesLine. User is allowed to change to other type at run-tome, such as bar. I just want save the settings, not graphics. The ploting can be done by pressing a button.
In function FormShow(), A .tee file is called, so the settings is loaded. In FormClose(), settings is saved to the .tee file.
It seems to me SaveChartFile() and LoadChartfromFile() work fine, but when I press a button to operate on series1, such as
Series1.clear() or Series1.AddXY()
I get a "Access violation" error message. It seems to me that I need to do something on series1, can you please point me how ? Thanks in advance.
Daniel
I have read tutorial #12 and also other related posts in this forum.
I include TeeEditPRO unit in my code. Below are bits of code, my question follows the code.
type
TMainForm = class(TForm)
....
series1 : TSeriesLine;
procedure MainForm.FormShow();
var
tmpChart:TCustomChart;
begin
DataChart.Free;
tmpChart:=TChart.Create(Self);
LoadChartfromFile(tmpChart,'cfg.tee');
DataChart := tmpChart as TChart;
DataChart.Parent:=Self;
end
procedure MainForm.FormClose();
begin
SaveChartToFile(DataChart, 'cfg.tee',False);
end;
Series1 is hard coded as TSeriesLine. User is allowed to change to other type at run-tome, such as bar. I just want save the settings, not graphics. The ploting can be done by pressing a button.
In function FormShow(), A .tee file is called, so the settings is loaded. In FormClose(), settings is saved to the .tee file.
It seems to me SaveChartFile() and LoadChartfromFile() work fine, but when I press a button to operate on series1, such as
Series1.clear() or Series1.AddXY()
I get a "Access violation" error message. It seems to me that I need to do something on series1, can you please point me how ? Thanks in advance.
Daniel
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Daniel,
Most likely that when importing a chart the series variable name is not persisted.
You could either assign first chart series to your variable, something like:
Or directly use TeeChart's series collection, for example:
Most likely that when importing a chart the series variable name is not persisted.
You could either assign first chart series to your variable, something like:
Code: Select all
Series1:=Chart1[0];
Code: Select all
Chart1[0].Clear;
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 |
Hi Narcis,
I still not sure
(1) What does
I still not sure
(1) What does
Code: Select all
Series1:=Chart1[0] mean here ?
(2) In existing code, Serise1 is defined as TLineSeries type, should it be TChartSeries ? because it may change type to TBarSeries.
Thanks in advance.
Daniel
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi nileiqi,
Suggestion 1 assigns the first series in a chart to the Series1 variable. However, the easier one may be suggestion 2 as this will always work if TChartSeries objects so no type cast will be necessary.
Suggestion 1 assigns the first series in a chart to the Series1 variable. However, the easier one may be suggestion 2 as this will always work if TChartSeries objects so no type cast will be necessary.
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 |