一个例子,原来写的 var data_sum:array[1..5] of integer; i:integer; begin dbchart1.Series[0].Clear; for i:=1 to 5 do data_sum[i]:=0; pub.showrecord(tmp,'*','T_teacher where dep='+''''+cbx_dep.Text+'''','teaid'); //showmessage(tmp.SQL.Text); Query.First; while not Query.Eof do begin if Query.FieldByName('edu').AsString='中师' then data_sum[1]:=data_sum[1]+1; if Query.FieldByName('edu').AsString='专科' then data_sum[2]:=data_sum[2]+1; if Query.FieldByName('edu').AsString='本科' then data_sum[3]:=data_sum[3]+1; if Query.FieldByName('edu').AsString='硕士' then data_sum[4]:=data_sum[4]+1; if Query.FieldByName('edu').AsString='博士' then data_sum[5]:=data_sum[5]+1; Query.Next; end; dbchart1.Series[0].Add(data_sum[1],'中师',clteecolor); dbchart1.Series[0].Add(data_sum[2],'专科',clteecolor); dbchart1.Series[0].Add(data_sum[3],'本科',clteecolor); dbchart1.Series[0].Add(data_sum[4],'硕士',clteecolor); dbchart1.Series[0].Add(data_sum[5],'博士',clteecolor);
1、SELECT 客户名,SUM(食品总额) AS 金额 FROM 表 GROUP BY 客户名 2、SELECT Month(订单时间) AS 月份,SUM(食品总额) AS 金额 FROM 表 GROUP BY Month(订单时间)
var data_sum:array[1..5] of integer;
i:integer;
begin
dbchart1.Series[0].Clear;
for i:=1 to 5 do
data_sum[i]:=0;
pub.showrecord(tmp,'*','T_teacher where dep='+''''+cbx_dep.Text+'''','teaid');
//showmessage(tmp.SQL.Text);
Query.First;
while not Query.Eof do
begin
if Query.FieldByName('edu').AsString='中师' then
data_sum[1]:=data_sum[1]+1;
if Query.FieldByName('edu').AsString='专科' then
data_sum[2]:=data_sum[2]+1;
if Query.FieldByName('edu').AsString='本科' then
data_sum[3]:=data_sum[3]+1;
if Query.FieldByName('edu').AsString='硕士' then
data_sum[4]:=data_sum[4]+1;
if Query.FieldByName('edu').AsString='博士' then
data_sum[5]:=data_sum[5]+1;
Query.Next;
end;
dbchart1.Series[0].Add(data_sum[1],'中师',clteecolor);
dbchart1.Series[0].Add(data_sum[2],'专科',clteecolor);
dbchart1.Series[0].Add(data_sum[3],'本科',clteecolor);
dbchart1.Series[0].Add(data_sum[4],'硕士',clteecolor);
dbchart1.Series[0].Add(data_sum[5],'博士',clteecolor);
2、SELECT Month(订单时间) AS 月份,SUM(食品总额) AS 金额 FROM 表 GROUP BY Month(订单时间)
请3楼的详细点好吗
Add一种图形
选择Series选项卡》DataSource》DataSet类型》....
下面应该不用说了