当前位置:主页>仓库管理软件> 列表

DBchart 显示数据问题

企业管理软件版1楼: 数据库中有两个字段:日期和产量,我希望把数据库中的数据
显示为“曲线”,横坐标为日期,纵坐标为产量。用DBchart 怎么设置,就好具体点,谢谢

2楼: 试一下
var myseries: TBarSeries;
myseries:= TBarSeries.Create(self);
myseries.ParentChart:=Frm_tjb.dbchart1;
myseries.Marks.Style:=smsValue;
myseries.DataSource:=Frm_tjb.ADOQuery1;
myseries.Title:=Frm_tjb.ADOQuery1.Fields[1].DisplayName;
myseries.YValues.ValueSource:=''产量字段名'';
myseries.xlabelssource:=''日期字段名''; 如管家婆软件介绍

3楼: 数据库我用的是mysql,用ADO我连接不上,所以我用的ODBC驱动,控件是database datasauce 和 query 请问用它应该怎样使用dbchart

4楼: procedure TFRM_XSSJFX.CheckBox_tpClick(Sender: TObject);
begin
if CheckBox_tp.Checked then
begin
i:=i+1;
Query5.Close;
Query5.sql.clear;
//Query2.sql.add(''select rq,rxse from klltab'');
Query5.sql.add(str3);


Query5.sql.add(''where ckbm like :q1'');
Query5.sql.add(''and rq>= :q2'');
Query5.sql.add(''and rq<= :q3'');
Query5.parambyname(''q1'').asstring :=''G'';
Query5.parambyname(''q2'').AsDateTime :=DateTime_c.DateTime;
Query5.parambyname(''q3'').AsDateTime :=DateTime_d.DateTime;
Query5.prepare;
Query5.open;
//以上是太平店

if not query5.Active then//连接的表
Exit;
Series_AddLine[4]:=TFastLineSeries.Create(DBChart2);
with Series_AddLine[4] do
begin
ParentChart:=DBChart2;
ShowInLegend:=True;
Title:=''太平店'';
DataSource:=query5;//这里就是动态指定数据集
XLabelsSource:=''rq'';
YValues.ValueSource:=query5.Fields[1].FieldName;
end;
end
else
begin
Series_AddLine[4].Free;
i:=i-1;
query5.Close;
end;
end;
你试着看一下,OK?

5楼: dgqdiy 不行啊,大哥,能不能把DBchart的设置说一下,不用语法,直接用它的感知直接显示也可以

6楼: 多人接受答案了。