用VFP图形向导,可以画出统计图形。在程序中如何实现呢?
统计图形需要随下表中数据的变化而变化。(数据有变化,记录数也有变化。)
表:部门 收入
01 240
02 260
03 270
04 230
.. ...
谢谢!
---------------------------------------------------------------
用mschart控件
---------------------------------------------------------------
给你一段代码看看吧.(在form中要先添加一个oldboundcontrol的控件)
sele pdate as month,&ldispfld
from tmp_costcal1;
where tmp_costcal1.prodno==allt(thisform.kftextbox1.value) .and. tmp_costcal1.pdate>date()-5*30;
into cursor tmp_costcal2
sele tmp_costcal2
lgdata=""
scan
lgdata=lgdata+chr(9)+str(month(month),2)+"月"
endscan
lgdata=lgdata+chr(13)+chr(10)
for lfcount=2 to fcount()
lgdata=lgdata+field(lfcount)
scan
lvar=field(lfcount)
lgdata=lgdata+chr(9)+allt(str(&lvar.,10,2))
endscan
lgdata=lgdata+CHR(13)+CHR(10)
endfor
creat cursor tmp_graph (graph g)
sele tmp_graph
appe blan
appe general graph data lgdata class "msgraph.chart"
thisform.oleboundcontrol1.controlsource="tmp_graph.graph"