for nLoop=1 to alen(aValues,1) && aValues contains needed values from table(s) cLegends=cLegends+chr(9)+alltrim(aValues[nLoop,1])+ ; str(100*aValues[nLoop,2]/nCounthist,6,2)+"%" cValues=cValues+chr(9)+str(aValues[nLoop,2]) endfor cGraphstring=cLegends+chr(13)+chr(10)+"Value"+cValues wait window "Formatting Graph... Wait, Please!" nowait if used("tmpStat3") select tmpStat3 use endif create cursor tmpStat3 (genfield G) append blank append general genfield class "msgraph.chart" data cGraphstring if type("this.oleGraph")<>"O" this.addobject("oleGraph","Oleboundcontrol") endif with this.oleGraph .left=this.shGraph.left+1 .width=this.shGraph.width-2 .top=this.shGraph.top+1 .height=this.shGraph.height-2 .autoactivate=0 && no on-line setting .controlsource="tmpStat3.genfield" do case case nStyle=1 && bar .haslegend=.f. case nStyle=2 && pie .haslegend=.t. .autoformat(5,1) endcase .visible=.t. endwith