Einzelnen Beitrag anzeigen

Benutzerbild von alcaeus
alcaeus

Registriert seit: 11. Aug 2003
Ort: München
6.537 Beiträge
 
#4

Re: DBChart aus Query zur Laufzeit füllen

  Alt 12. Mai 2005, 10:57
Hallo ihr,

ich hab mal meine Delphi-Hilfe konsultiert, und folgendes gefunden:

Zitat:
TeeChart Charts will connect with 3 different types of Dataset.
TTable
TQuery
TClientDataset
The minimum that requires to be set in each case is:
The name of the database,
For the table the TableName of a table
or
in the case of the query a valid SQL string.
or
in the case of a ClientDataset Define source (right button on TClientDataset object in form).
Remember to activate the Dataset by setting the Active property to True.

...


You may populate your Chart at runtime by coding which Series to add to the Chart and defining the fields of those Series.
It assumes you have a table on your form, Table1 with fields Name and Amount.

Delphi-Quellcode:
Var
MySeries,Ave:TLineSeries;

MySeries:=TLineSeries.Create( Self );
With MySeries do
begin
 ParentChart:=DBChart1;
 DataSource:=Table1;
 XLabelsSource:='Name';
 YValues.ValueSource:= 'Amount';
 CheckDatasource;
end;
Verwendet hab ich das Ding nie, also kann ich nicht mehr als das sagen. Vielleicht hilft es euch aber trotzdem weiter

Greetz
alcaeus
Andreas B.
Die Mutter der Dummen ist immer schwanger.
Ein Portal für Informatik-Studenten: www.infler.de
  Mit Zitat antworten Zitat