What is the fast way to show TChart in Intraweb
Posted: Sun Feb 01, 2015 4:57 pm
Hello,
I'm using the following code (thanks to Alexandre Machado) to show some charts in my Intraweb application :
Cause I need to deploy my application as an ISAPI dll I use the following code in my main form to initialize the GDI+ that seems to be necessary to TChart component :
I noticed that it takes some seconds to show the form.
Is the above code the fastest way to show TChart in Intraweb application ?
Is the GDI+ initialization that took some time to initialize ?
If yes, is it possible to avoid the GDI+ initialization ?
If no, how can I speed up the showing of the form in my Intarweb ISAPI application ?
Thank you,
Davide
I'm using the following code (thanks to Alexandre Machado) to show some charts in my Intraweb application :
Code: Select all
procedure CopyChartToImage(const aChart: TChart; const aImage: TIWCGJQImage);
var
xMetaFile: TMetafile;
xBitmap: TBitmap;
xRect: TRect;
begin
xBitmap := aImage.Picture.Picture.Bitmap;
xBitmap.Width := aChart.Width;
xBitmap.Height := aChart.Height;
xRect := Rect(0, 0, aChart.Width, aChart.Height);
aChart.BufferedDisplay := False;
xMetaFile := aChart.TeeCreateMetafile(False, xRect);
try
xBitmap.Canvas.Draw(0, 0, xMetaFile);
finally
FreeAndNil(xMetaFile);
end;
end;
Code: Select all
procedure GDIPlus_Initialize;
begin
StartupInput.DebugEventCallback := nil;
StartupInput.SuppressBackgroundThread := False;
StartupInput.SuppressExternalCodecs := False;
StartupInput.GdiplusVersion := 1;
GdiplusStartup(gdiplusToken, @StartupInput, nil);
end;
procedure GDIPlus_Finalize;
begin
if Assigned(GenericSansSerifFontFamily) then
GenericSansSerifFontFamily.Free;
if Assigned(GenericSerifFontFamily) then
GenericSerifFontFamily.Free;
if Assigned(GenericMonospaceFontFamily) then
GenericMonospaceFontFamily.Free;
if Assigned(GenericTypographicStringFormatBuffer) then
GenericTypographicStringFormatBuffer.free;
if Assigned(GenericDefaultStringFormatBuffer) then
GenericDefaultStringFormatBuffer.Free;
GdiplusShutdown(gdiplusToken);
end;
initialization
GDIPlus_Initialize;
finalization
GDIPlus_Finalize;
Is the above code the fastest way to show TChart in Intraweb application ?
Is the GDI+ initialization that took some time to initialize ?
If yes, is it possible to avoid the GDI+ initialization ?
If no, how can I speed up the showing of the form in my Intarweb ISAPI application ?
Thank you,
Davide