Login

Lost Password?

Register

Register
Delphi Forum - Delphi Programming Kings of Code
Welcome to Delphifan.com - Registration is Closed!!.Time a new registration you can follow on our Facebook page https://www.facebook.com/DelphiProgramming/ -- New Delphifan Video Protal is open. Please visit us to www.delphifan.net . Delphifan Crew

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Login or Register
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create graphics in IntraWeb using the traditional DBChart in delphi
08-07-2017, 08:38 PM
Post: #1
How to create graphics in IntraWeb using the traditional DBChart in delphi

1) Create a VCL Form of type TForm and save it with the name FrmRelAgingListGrafico

2) In this VCL Form, create the following components:
    DBChart1: TDBChart (Paleta TeeChart Standard)
    DBChart2: TDBChart (Paleta TeeChart Standard)

3) Create the Chart of the traditional way in delphi

4) In the UserSession, create a function to return the wwwroot folder. Uses IW.Common.AppInfo
function TIWUserSession.wwwroot_Folder: String;
begin
  Result := IncludeTrailingPathDelimiter(TIWAppinfo.GetAppPath) + 'wwwroot';
  {$I-}
  ChDir(Result);
  if (IOResult <> 0) then
    MkDir(Result);
  {$I+}
end;

5) Na Unit1 do Intraweb...
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject;
  EventParams: TStringList);
var
  Grafico1, Grafico2: String;
begin
  with TFrmRelAgingListGrafico.Create(nil) do
  begin
    // ClientDataset of chart 1
    ClientDataSet1.FileName := UserSession.wwwroot_Folder +  'Aging_List.xml';
    ClientDataSet1.Open;
    // ClientDataset of chart 2
    CdsResumo.FileName := UserSession.wwwroot_Folder +  'resumo.xml';
    CdsResumo.Open;
    CdsResumo.IndexFieldNames := 'DESCRICAO';
    // Export the image from chart 1 to bmp format
    Grafico1 := UserSession.wwwroot_Folder +  'grafico.bmp';
    DBChart1.SaveToBitmapFile(Grafico1);
    // Export the image from chart 2 to bmp format
    Grafico2 := UserSession.wwwroot_Folder +  'resumo.bmp';
    DBChart2.SaveToBitmapFile(Grafico2);
    // Function to join the two bitmaps in a single file and save in jpg format. You can join multiple images into one.
    UnirBitmaps(Grafico1, Grafico2, UserSession.wwwroot_Folder +  'grafico.jpg');
    // If you are only displaying a graph, simply convert the bmp to jpg
    BitmapFileToPNG(Grafico1, UserSession.wwwroot_Folder +  'Teste.jpg');
    ClientDataSet1.Close;
    CdsResumo.Close;
    DeleteFile(Grafico1);
    DeleteFile(Grafico2);
    Close;
  end;
  // Finally, enter the URL to display the jpg image
  IWURLWindow1.URI := './grafico.jpg';
  IWURLWindow2.URI := './Teste.jpg';
end;

Source code included


Attached File(s)
.zip  Chart.zip (Size: 139.58 KB / Downloads: 3)

My Last Threads
0
Quote this message in a reply
Post Reply 


Messages In This Thread
How to create graphics in IntraWeb using the traditional DBChart in delphi - jerrivaldo - 08-07-2017 08:38 PM

Possibly Related Threads...
Thread: Author Replies Views: Last Post
  DevExpress 13.1.4 Delphi XE5 ilsouza 17 8,727 04-06-2015 07:22 AM
Last Post: galdariah

Forum Jump:


User(s) browsing this thread: 1 Guest(s)



Theme designed by Delphifan (Sidebar created by Delphifan - Delphifan.com)
Copyright © 2017 Delphi Forum - Delphi Programming Kings of Code - All rights reserved.


For GOLD or Payment Vip User Please send PM to Administrator


Delphi,Embarcadero,Delphi XE6,Delphi XE7,Delphi XE5,TMS,Devexpress,Delphi Components,Full Delphi Download,Delphi Android,Delphi IOS,Delphi Mobile programming,Delphi Forum,Embarcadero Berlin 10.1