如何在PB中实现图形(饼图,直方图,点图等)
<P><FONT color=#666699><STRONG> <FONT color=#000000>本人在学习中要在PB中实现以上各图的显示,数据在数据库里,要从数据库里查询到这些数据生成这些图形并对这些图形进行分析,从而得出加工误差的情况,望高手指点下.谢谢!本人用的是PB9.0版本.</FONT></STRONG></FONT></P><P>for ww=1 to c - 1 //www是不合格品数量最多的数<BR> if bhgp[ww]>bhgp[ww+1] then<BR> tt=bhgp[ww+1]<BR> bhgp[ww+1]=bhgp[ww]<BR> bhgp[ww]=tt //bhgp[ww+1]=max<BR> end if<BR>next<BR>www=bhgp[c]<BR>for i=1 to dw_4.rowcount() //找到原因代号<BR> if www=dw_4.getitemnumber(i,"bad_part_number") then<BR> aa=dw_4.getitemnumber(i,"reason_id")<BR> end if<BR>next<BR>for i=1 to dw_2.rowcount() //找到原因代号<BR> if aa=dw_2.getitemnumber(i,"reason_id") then<BR> b=dw_2.getitemstring(aa,"reason")<BR> end if<BR>next</P>
<P><BR> messagebox("提示",&<BR> "最大不合格品数量为"+string(www)+",它所对应的原因是"+string(b)+",这就是最主要的影响因素")<BR> <BR><BR><BR>参考别人做的是以上程序但窗口上根本没DW_1和DW_2控件。不知道从何而来,我用的是窗口.DW_1的形式但出错,出错原因是null object reference at line 4 in clicked event of object cb_1 of w_hege(我的窗口名),真诚的希望高手指点下</P> 1、PB中实现图形(饼图,直方图,点图等):<BR>file-->new-->datawindow-->graph 可以建立各種圖形。<BR>2、DW_1和DW_2不是控件,是datawindow;也要把別人的DW_1和DW_2拷過來。<BR>3、w_hege窗口的cb_1 對象的clicked事件中第四行,空的對象。<BR>希望對你有幫助。
回复:(liucuimaomao)如何在PB中实现图形(饼图,...
我试了下,但里面的Catagory和value 值应该如何设置呢? Catagory :橫坐標的值<BR>value :指縱坐標的值。<BR>選擇表的欄位分別設定。回复:(liucuimaomao)如何在PB中实现图形(饼图,...
<P>谢谢<BR>!</P> <P>你好,上班qq不太方便。以下是我做的graph:<BR>table:test<BR>name char<BR>number number<BR>month char<BR>no char<BR><BR>name number month no<BR>a產品 50 02 4<BR>b產品 100 02 5<BR>c產品 45 02 6<BR>a產品 20 01 1<BR>b產品 30 01 2<BR>c產品 50 01 3<BR>a產品 82 03 7<BR>b產品 41 03 8<BR>c產品 12 03 9<BR><BR><BR><BR>方法1:graph控件<BR>用graph控件要增加一個dw窗口或建個動態窗口,將數據放在此窗口中,通過按鈕把數據數據顯示在graph中。<BR><BR>按鈕clicked事件代碼:<BR>int rows,i,yis<BR>string xis,ls_mon<BR>integer SeriesNbr1,SeriesNbr2,SeriesNbr3<BR>dw_1.SetTransObject(sqlca) <BR>dw_1.Retrieve() <BR>rows = rowcount(dw_1) <BR>messagebox('rows',rows)<BR>if rows>0 then <BR>gr_1.SetRedraw(False) // <BR>gr_1.reset(all!) //清空graph的所有數據 <BR>//gr_1.addseries('number') //<BR>//gr_1.addseries('01')<BR>//SeriesNbr1 = gr_1.FindSeries("01")<BR>//<BR>//gr_1.InsertSeries("02", SeriesNbr1)<BR>//SeriesNbr2 = gr_1.FindSeries("02")<BR>//<BR>//gr_1.InsertSeries("03", SeriesNbr2)<BR>//SeriesNbr3 = gr_1.FindSeries("03")</P><P><BR>gr_1.addseries('a產品~')// 增加一組<BR>SeriesNbr1 = gr_1.FindSeries('a產品~')//在圖形中獲得一個組的數據。</P>
<P>gr_1.InsertSeries('b產品~', SeriesNbr1)//插入一組<BR>SeriesNbr2 = gr_1.FindSeries('b產品~')</P>
<P>gr_1.InsertSeries('c產品~', SeriesNbr2)//插入一組<BR>SeriesNbr3 = gr_1.FindSeries('c產品~')</P>
<P><BR>for i =1 to rows <BR> <BR>if SeriesNbr1 = 1 then<BR>xis=getitemstring(dw_1,i,'month') <BR>yis=getitemnumber(dw_1,i,'number') <BR>ls_mon=getitemstring(dw_1,i,'name') <BR><BR>if isnull(yis) then <BR> yis=0 <BR>end if <BR>end if </P>
<P><BR>//if SeriesNbr1 = integer(ls_mon) then<BR>// <BR>//gr_1.adddata(SeriesNbr1,yis,xis) <BR>//<BR>//elseif SeriesNbr2 = integer(ls_mon) then <BR>// <BR>//gr_1.adddata(SeriesNbr2,yis,xis) <BR>//<BR>//elseif SeriesNbr3 = integer(ls_mon) then <BR>// <BR>//gr_1.adddata(SeriesNbr3,yis,xis) <BR>//<BR>//end if </P>
<P><BR>if ls_mon = 'a產品~' then<BR> <BR>gr_1.adddata(SeriesNbr1,yis,xis)</P>
<P>elseif ls_mon = 'b產品~' then <BR> <BR>gr_1.adddata(SeriesNbr2,yis,xis) </P>
<P>elseif ls_mon = 'c產品~' then <BR> <BR>gr_1.adddata(SeriesNbr3,yis,xis) </P>
<P>end if </P>
<P>next <BR>gr_1.SetRedraw(True) //相當於刷新吧</P>
<P>end if <BR><BR>方法2:new datawindow--->graph<BR>按鈕clicked事件代碼:<BR>dw_1.SetTransObject(sqlca) <BR>dw_1.Retrieve() <BR>dw_1.accepttext()<BR>點擊按鈕可顯示圖。<BR>如有問題,我再把pbl發給你。</P>
回复:(liucuimaomao)如何在PB中实现图形(饼图,...
<P> 我用了第二种方法,但运行不出来[em08]</P>回复:(liucuimaomao)如何在PB中实现图形(饼图,...
直方图点图有案例么? dw_1.accepttext()<BR>是不是dw_1.accept后跟的是建的表名? <P>dw_1.accepttext()不是跟的是建的表名,<BR>Syntax <BR>dwcontrol.AcceptText ( )<BR>英文不太好,不會翻譯。自我理解,接收文件的意思。<BR>Applies the contents of the DataWindow's edit control to the current item in the buffer of a DataWindow control or DataStore. The data in the edit control must pass the validation rule for the column before it can be stored in the item.<BR><BR>我把pbl 發給你。我的mail是<a href="mailto:sbtxgtgmy@163.com" target="_blank" >sbtxgtgmy@163.com</A> ,不要拒收喔</P>页:
[1]
