Steema Issues Database

Note: 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.



Bug 2067

Summary: Access violation after loading a chart
Product: VCL TeeChart Reporter: info <info>
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED NOTABUG    
Severity: normal CC: david, sandra
Priority: Normal    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: Executable file with source code (Delphi 7), which demonstrates the access violation

Description info@redusoft.de 2018-08-03 08:32:43 EDT
Created attachment 841 [details]
Executable file with source code (Delphi 7), which demonstrates the access violation

Dear Sirs,

an access violation appears if a loaded Chart must be edited.

By a click on Button 'Save' (Button1) Chart1 is saved.
After a click on Button 'Load' (Button2) the Chart1 will be loaded.
This works. 

But if the loaded Chart1 thereupon will be edited (by a click on Button 'EditSeries' (Button3) an access violation appears. Could you please give me an answer what's wrong there ?

Only the following code is implemented:

procedure TForm1.Button1Click(Sender: TObject);
begin
 SaveChartToFile( TCustomChart( Chart1 ), 'd:\mychart1.tee',true,true);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 LoadChartFromFile( TCustomChart( Chart1 ), 'd:\mychart1.tee');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 EditSeries(Self,Series1); // -> results in an access violation if a 
                           // saved chart is loaded.
end;

In attachmaent you can find the exe file and the source code of the 
application which doesn't work correctly. Please start the file project1.exe and click on Button 'Save' to save the chart. Then click on Button 'Load' to load the chart. After a click on Button 'EditSeries' the error (access violation) occurs.


Best regards 

Ralf Riescher
Comment 1 sandra pazos 2018-09-10 11:11:19 EDT
We find a workaround to fix the problem you experiencing. Basically, you need use Chart[0] instead of Series1. 

The code below shows how can do it:

procedure TForm1.Button3Click(Sender: TObject);
begin

 EditSeries(Self,Chart1[0]);

end;
Comment 2 sandra pazos 2018-09-10 11:12:30 EDT
*** Bug 2068 has been marked as a duplicate of this bug. ***
Comment 3 david berneda 2023-03-15 15:45:19 EDT
When loading a chart, the series contained in it are not automatically assigned to variables in the form.

So, Series1 is not assigned to Chart1.Series[0] when loading it back.

Delphi maintains the Series1 variable when loading the DFM form for the first time, but not for later save/load.

The workaround is, after loading the form, to manually reset the variable:

procedure TForm1.Button2Click(Sender: TObject);
begin
 LoadChartFromFile( TCustomChart( Chart1 ), 'c:\mychart1.tee');

 Series1 := Chart1[0];   // <--- 
end;