BBs
BBs

Reputation: 33

Delphi 7 how to load data from an ADOQuery to a DBChart at runtime

Im having the following problem with Delphi 7. I try to use a DBchart to represent some data with a line diagram from a database. I want the data to be loaded from an ADOQuery that gets activated at runtime thought. I can do it without problem with a query that has a static SQL value, but i find problems at setting the datasource at runtime.

I try to use

dbchart1.series[1].datasource:=ADOQuery3;

After i have created series1, but i get a "list index out of bounds" error. Am i using the wrong command? I tried several others but failed. Anyone can give some help with this?

Upvotes: 1

Views: 1545

Answers (1)

BBs
BBs

Reputation: 33

Solved it with the following (after creating series1 at the DBGrid)

with series1 do
begin
datasource:=ADOquery;
xlabelssource:='field1';
YValues.Valuesource:='field2';
checkdatasource;
end;

Upvotes: 1

Related Questions