Chart 2 SWF

Submitted by eLenka on 4 August, 2010 - 14:15
Convert chart to SWF

One more example of using of TFlashCanvas. It converts charts to SWF.

Source archive: chart.zip ( 448 KB)

 
Some sample source: 
procedure TChart2SWF.ConvertChart(Flag:boolean);
var
  Bm: TMetaFile;
  Movie: TFlashMovie;
begin
  Chart.CopyToClipboardMetafile(True);
  Bm:=TMetaFile.Create;
  Bm.Assign(ClipBoard);
 
  Movie := TFlashMovie.Create(0, 0,  Flash.Width* twips, Flash.Height * twips, 1);
  Movie.SystemCoord := scPix;
 
  Movie.Canvas.EmbeddedFont := Flag;
  Movie.Canvas.StretchDraw(Rect(0,0, Bm.Width, Bm.Height), Bm) ;
  Bm.Free;
 
  Movie.Canvas.Place(2, False);
  Movie.ShowFrame;
  Movie.MakeStream;
  if MovieFileName= '' then MovieFileName := ExtractFilePath(ParamStr(0)) + IntToStr(Random(9999))+ '.swf';
  Movie.SaveToFile(MovieFileName);
  Movie.Free;
end;