*** set the LOCALEID to English nlLocaleId=sys(3004) && Save local id =sys(3006,1033) && We will be sending instructions in English * Part of xlChartType constants #Define xl3DArea -4098 #Define xl3DColumn -4100 #Define xl3DLine -4101 #Define xl3DPie -4102 #Define xlArea 1 #Define xlBubble3DEffect 87 #Define xlLine 4 #Define xlPie 5 #Define xlRadar -4151 #Define xlSurface 83 #Define TABULATE CHR(9) #Define CRLF CHR(13)+CHR(10) Create cursor test (degree i, sine n(8,4) NULL, cosine n(8,4)) For ix = 1 to 90 Insert into test ; values ; (ix,cos(ix)*ix,sin(ix)*ix) Endfor 45 Scan next 30 && Nullify 30 degrees Replace sine with .null. && Nullify some values to see effect Endscan Wait window nowait "Filling cell values..." MCGDATA = "" nCols = fcount() For ix = 1 to nCols MCGDATA = MCGDATA + iif(empty(MCGDATA),"",TABULATE)+field(ix) Endfor MCGDATA = MCGDATA + CRLF Scan For ix = 1 to nCols MCGDATA = MCGDATA + iif(ix=1,"",TABULATE)+nvl(str(evaluate(field(ix))),"") Endfor MCGDATA = MCGDATA + CRLF Endscan * Data prepare * Create cursor testgen (graphtest g) Append blank Append general graphtest class MSGraph.Chart.5 data MCGDATA oForm = createobject("Form") With oForm .height = 400 .width = 600 .show .closable = .f. .addobject("myGraph","OleBoundControl") .addobject("myQuit1","myQuit") .addobject("myChanger1","myPlotChanger") .addobject("myTypeChanger","cmbChartTypes") With .myGraph .height = oForm.height - 20 .width = oForm.width .left = 0 .top = 0 .ControlSource = "testgen.graphtest" Wait window nowait "Plotting..." .haslegend = .t. .ChartType=xlLine .object.application.plotby = 2 Wait clear .visible=.T. Endwith .myQuit1.visible = .t. .myChanger1.visible = .t. .myTypeChanger.visible = .t. Endwith **** Set the LocaleId to the previous value =sys(3006,val(nlLocaleId)) Read events Define class myquit as commandbutton Left=1 Top=0 AutoSize = .T. Caption="Close" Procedure click Release all Clear events Endproc Enddefine Define class myPlotChanger as commandbutton Left=150 Top=0 AutoSize = .T. Caption="Change plotby" Procedure click With thisform.myGraph.object.application .plotby = iif(.plotby=1,2,1) Endwith Endproc Enddefine Define class cmbChartTypes as combobox Left=300 Top=0 Width = 200 Procedure init With this .Addlistitem('3DArea',1,1) .Addlistitem(transform(xl3DArea),1,2) .AddlistItem('3DColumn',2,1) .AddlistItem(transform(xl3DColumn),2,2) .AddlistItem('3DLine',3,1) .AddlistItem(transform(xl3DLine),3,2) .AddlistItem('3DPie',4,1) .AddlistItem(transform(xl3DPie),4,2) .AddlistItem('Area',5,1) .AddlistItem(transform(xlArea),5,2) .AddlistItem('Bubble3DEffect',6,1) .AddlistItem(transform(xlBubble3DEffect),6,2) .AddlistItem('Line',7,1) .AddlistItem(transform(xlLine),7,2) .AddlistItem('Pie',8,1) .AddlistItem(transform(xlPie),8,2) .AddlistItem('Radar',9,1) .AddlistItem(transform(xlRadar),9,2) .AddlistItem('Surface',10,1) .AddlistItem(transform(xlSurface),10,2) .Columncount = 2 .Columnwidths = '120,50' Endwith Endproc Procedure interactivechange With thisform.myGraph .ChartType = val(this.List(this.Listindex,2)) .Setfocus Endwith This.setfocus Endproc EnddefineCetin