Board index » delphi » URGENT please - TChart and TPNGExport crashing program

URGENT please - TChart and TPNGExport crashing program

I have created a chart fine and display it to the users no
problem, but I also try and export the chart to a png file for
display on the web, now on my development machine this works
fine and the file is successfully created but...

When I try and execute this functionality on another computer
when I try and create the file on the local system the whole
application crashes with:

"exception class   : EAccessViolation

exception message : Access violation at address 00000000. Read
of address 00000000."

now when I check the file has actually been created but the size
is 0 bytes and the contents of the file is empty...

I think I have all the bpl files I need (though they are
supposed to be compiled into the app) and Im at a loss now to
track this issue.

the exception occues in this procedure of mine...

{*****************************************************************}
{*                                                               *}
{*   procedure converts the chart to a png file stored locally   *}
{*   on the hard drive to be uploaded to the ftp server and      *}
{*   uploaded into the database as a blob                        *}
{*                                                               *}
{*****************************************************************}
procedure ChartToPNG(s_filename:string);
var
  tmp:tpngexportformat;
begin
  //set up the png image
  tmp:= TPNGExportFormat.Create;
  //assign the chart to the png image
  tmp.Panel := form4.Chart1;
  //check to see if we have already saved a chart for this site and block
  if fileexists(s_filename) then
  begin
    //we have so delete it first as it is going to be replaced
    deletefile(s_filename);
  end;
  //save the png image to file
  tmp.SaveToFile(s_filename);
  //free the memory
  tmp.free;
end;{charttopng}

the exception happens ion the savetofile command. and s_filename is just a filename in the current directory.

Can you please help me with this issue, Im stuck.

Cheers

Chris Veale

 

Re:URGENT please - TChart and TPNGExport crashing program


Its ok Ive found the problem...
Quote
"Chris Veale" <cve...@hortresearch.co.nz> wrote:

>I have created a chart fine and display it to the users no
>problem, but I also try and export the chart to a png file for
>display on the web, now on my development machine this works
>fine and the file is successfully created but...

>When I try and execute this functionality on another computer
>when I try and create the file on the local system the whole
>application crashes with:

>"exception class   : EAccessViolation

>exception message : Access violation at address 00000000. Read
>of address 00000000."

>now when I check the file has actually been created but the size
>is 0 bytes and the contents of the file is empty...

>I think I have all the bpl files I need (though they are
>supposed to be compiled into the app) and Im at a loss now to
>track this issue.

>the exception occues in this procedure of mine...

>{*****************************************************************}
>{*                                                               *}
>{*   procedure converts the chart to a png file stored locally   *}
>{*   on the hard drive to be uploaded to the ftp server and      *}
>{*   uploaded into the database as a blob                        *}
>{*                                                               *}
>{*****************************************************************}
>procedure ChartToPNG(s_filename:string);
>var
>  tmp:tpngexportformat;
>begin
>  //set up the png image
>  tmp:= TPNGExportFormat.Create;
>  //assign the chart to the png image
>  tmp.Panel := form4.Chart1;
>  //check to see if we have already saved a chart for this site and block
>  if fileexists(s_filename) then
>  begin
>    //we have so delete it first as it is going to be replaced
>    deletefile(s_filename);
>  end;
>  //save the png image to file
>  tmp.SaveToFile(s_filename);
>  //free the memory
>  tmp.free;
>end;{charttopng}

>the exception happens ion the savetofile command. and s_filename is just a filename in the current directory.

>Can you please help me with this issue, Im stuck.

>Cheers

>Chris Veale

Other Threads