Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renomeando arquivos - google chart api

  • Loading branch information...
commit 115439c0c7a16aee9f187e165796f6e490ddb783 1 parent 57e1e80
@dwildt authored
View
40 GoogleGraph.cfg
@@ -1,40 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
--H+
--W+
--M
--$M16384,1048576
--K$00400000
--E".\exe"
--N".\dcu"
--LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
--LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
--w-UNSAFE_TYPE
--w-UNSAFE_CODE
--w-UNSAFE_CAST
View
146 GoogleGraph.dof
@@ -1,146 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=.\exe
-UnitOutputDir=.\dcu
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;EPCOTAUtils70
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1046
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[HistoryLists\hlUnitAliases]
-Count=1
-Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[HistoryLists\hlUnitOutputDirectory]
-Count=1
-Item0=.\dcu
-[HistoryLists\hlOutputDirectorry]
-Count=2
-Item0=.\exe
-Item1=./exe
View
13 GoogleGraph.dpr
@@ -1,13 +0,0 @@
-program GoogleGraph;
-
-uses
- Forms,
- UFormGoogleChart in 'src\UFormGoogleChart.pas' {FormGoogleChart};
-
-{$R *.res}
-
-begin
- Application.Initialize;
- Application.CreateForm(TFormGoogleChart, FormGoogleChart);
- Application.Run;
-end.
View
BIN  GoogleGraph.res
Binary file not shown
View
146 src/UFormGoogleGraph.dfm
@@ -1,146 +0,0 @@
-object FormGoogleChart: TFormGoogleChart
- Left = 192
- Top = 124
- BorderIcons = [biSystemMenu, biMinimize]
- BorderStyle = bsSingle
- Caption = 'Demonstra'#231#227'o de uso do Google Chart em um app Desktop'
- ClientHeight = 339
- ClientWidth = 707
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- OldCreateOrder = False
- PixelsPerInch = 96
- TextHeight = 13
- object lblFill: TLabel
- Left = 8
- Top = 8
- Width = 434
- Height = 14
- Caption =
- 'Preencha tipos e valores - salve para ver o gr'#225'fico gerado via G' +
- 'oogle Graph API'
- Font.Charset = ANSI_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'Arial'
- Font.Style = [fsBold]
- ParentFont = False
- end
- object DBGrid: TDBGrid
- Left = 8
- Top = 24
- Width = 177
- Height = 265
- DataSource = dsTipos
- TabOrder = 0
- TitleFont.Charset = DEFAULT_CHARSET
- TitleFont.Color = clWindowText
- TitleFont.Height = -11
- TitleFont.Name = 'MS Sans Serif'
- TitleFont.Style = []
- Columns = <
- item
- Expanded = False
- FieldName = 'Tipo'
- Width = 100
- Visible = True
- end
- item
- Expanded = False
- FieldName = 'Valor'
- Width = 40
- Visible = True
- end>
- end
- object WebBrowser: TWebBrowser
- Left = 192
- Top = 24
- Width = 500
- Height = 300
- TabOrder = 1
- ControlData = {
- 4C000000AD330000021F00000000000000000000000000000000000000000000
- 000000004C000000000000000000000001000000E0D057007335CF11AE690800
- 2B2E126208000000000000004C0000000114020000000000C000000000000046
- 8000000000000000000000000000000000000000000000000000000000000000
- 00000000000000000100000000000000000000000000000000000000}
- end
- object DBNavigator: TDBNavigator
- Left = 8
- Top = 291
- Width = 175
- Height = 33
- DataSource = dsTipos
- VisibleButtons = [nbInsert, nbDelete, nbEdit, nbPost, nbCancel]
- Flat = True
- TabOrder = 2
- end
- object dsTipos: TDataSource
- DataSet = cdsTipos
- Left = 32
- Top = 48
- end
- object cdsTipos: TClientDataSet
- Active = True
- Aggregates = <>
- Params = <>
- AfterPost = cdsTiposAfterPost
- AfterDelete = cdsTiposAfterDelete
- Left = 32
- Top = 80
- Data = {
- 410000009619E0BD010000001800000002000000000003000000410004546970
- 6F0100490000000100055749445448020002001E000556616C6F720400010000
- 0000000000}
- object cdsTiposTipo: TStringField
- FieldName = 'Tipo'
- Size = 30
- end
- object cdsTiposValor: TIntegerField
- FieldName = 'Valor'
- end
- end
- object pgProdGooglePie: TPageProducer
- HTMLDoc.Strings = (
- '<html>'
- ' <head>'
-
- ' <script type="text/javascript" src="https://www.google.com/j' +
- 'sapi"></script>'
- ' <script type="text/javascript">'
-
- ' google.load("visualization", "1", {packages:["corechart"]}' +
- ');'
- ' google.setOnLoadCallback(drawChart);'
- ' function drawChart() {'
- ' var data = google.visualization.arrayToDataTable(['
- ' ['#39'Tipo'#39', '#39'Valor'#39'],'
- ' <#DATA>'
- ' ]);'
- ''
- ' var options = {'
- ' title: '#39'An'#225'lise feita no Delphi com Google Graph'#39
- ' };'
- ''
-
- ' var chart = new google.visualization.PieChart(document.g' +
- 'etElementById('#39'chart_div'#39'));'
- ' chart.draw(data, options);'
- ' }'
- ' </script>'
- ' </head>'
- ' <body margintop=0 marginleft=0 marginright=0 marginbottom=0>'
-
- ' <div id="chart_div" style="width: 455px; height: 255px;"></d' +
- 'iv>'
- ' </body>'
- '</html>')
- OnHTMLTag = pgProdGooglePieHTMLTag
- Left = 32
- Top = 112
- end
-end
View
124 src/UFormGoogleGraph.pas
@@ -1,124 +0,0 @@
-unit UFormGoogleGraph;
-
-(*
-
-Exemplo de uso do TWebBrowser e componentes DataAware para interagir com
-o Google Chart API.
-
-Gráfico de exempo: Pie Chart
-https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart
-
-Organizado por:
-Daniel Wildt
-http://danielwildt.com
-http://twitter.com/dwildt
-
-Sobre o funcionamento do código:
-Simplesmente preencha Tipos e valores no grid.
-Ao salvar o ClientDataSet vai disparar um evento para gerar o gráfico.
-Ao gravar e ao deletar linhas o evento é disparado.
-
-
-*)
-
-
-interface
-
-uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, DBCtrls, OleCtrls, SHDocVw, HTTPApp, HTTPProd, DB,
- StdCtrls, Grids, DBGrids, DBClient;
-
-type
- TFormGoogleChart = class(TForm)
- dsTipos: TDataSource;
- cdsTipos: TClientDataSet;
- DBGrid: TDBGrid;
- lblFill: TLabel;
- cdsTiposTipo: TStringField;
- cdsTiposValor: TIntegerField;
- pgProdGooglePie: TPageProducer;
- WebBrowser: TWebBrowser;
- DBNavigator: TDBNavigator;
- procedure cdsTiposAfterDelete(DataSet: TDataSet);
- procedure cdsTiposAfterPost(DataSet: TDataSet);
- procedure pgProdGooglePieHTMLTag(Sender: TObject; Tag: TTag;
- const TagString: String; TagParams: TStrings;
- var ReplaceText: String);
- private
- procedure GerarGrafico;
- { Private declarations }
- public
- { Public declarations }
- end;
-
-var
- FormGoogleChart: TFormGoogleChart;
-
-implementation
-
-{$R *.dfm}
-
-uses ActiveX;
-
-procedure TFormGoogleChart.cdsTiposAfterDelete(DataSet: TDataSet);
-begin
- GerarGrafico;
-end;
-
-procedure TFormGoogleChart.cdsTiposAfterPost(DataSet: TDataSet);
-begin
- GerarGrafico;
-end;
-
-procedure TFormGoogleChart.GerarGrafico;
- var
- sl: TStringList;
- ms: TMemoryStream;
-begin
- WebBrowser.Navigate('about:blank') ;
- while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do
- Application.ProcessMessages;
-
- if Assigned(WebBrowser.Document) then
- begin
- sl := TStringList.Create;
- try
- ms := TMemoryStream.Create;
- try
- sl.Text := pgProdGooglePie.Content;
- sl.SaveToStream(ms) ;
- ms.Seek(0, 0) ;
- (WebBrowser.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms)) ;
- finally
- ms.Free;
- end;
- finally
- sl.Free;
- end;
- end;
-end;
-
-procedure TFormGoogleChart.pgProdGooglePieHTMLTag(Sender: TObject; Tag: TTag;
- const TagString: String; TagParams: TStrings; var ReplaceText: String);
-begin
- if TagString = 'DATA' then
- begin
- cdsTipos.First;
- ReplaceText := '';
- while (not cdsTipos.Eof) do
- begin
- ReplaceText := ReplaceText +
- '[' +
- QuotedStr(cdsTipos.FieldByName('Tipo').AsString) +
- ',' +
- cdsTipos.FieldByName('Valor').AsString +
- ']';
- cdsTipos.Next;
- if(not cdsTipos.Eof) then
- ReplaceText := ReplaceText + ',';
- end;
- end;
-end;
-
-end.
Please sign in to comment.
Something went wrong with that request. Please try again.