*** set the LOCALEID to English nlLocaleId=Sys(3004) && Save local id =Sys(3006,1033) && We will be sending instructions in English #include xlconstants.h #Define TABULATE Chr(9) Wait Window Nowait "Filling cell values..." Select a.first_name-(' ' +a.last_name ) As Employee,; b.country, Sum(c.Order_amt) As TotOrder; FROM customer b ; INNER Join orders c On b.cust_id = c.cust_id ; INNER Join Employee a On a.emp_id = c.emp_id ; GROUP By 2, 1 ; into Cursor myCursor Do (_Genxtab) lcTempFile = Sys(2015)+'.tmp' Copy To (lcTempFile) Type Csv MCGDATA = Chrtran(Filetostr(lcTempFile),',',TABULATE) Erase (lcTempFile) Create Cursor testgen (graphtest g) Append Blank Wait Window Nowait "Plotting..." Append General graphtest Class MSGraph.Chart Data MCGDATA oForm = Createobject("myForm") With oForm .Show .AddObject("myGraph","OleBoundControl") .AddObject("Exporter","Exporter") .Exporter.Visible = .T. With .myGraph .Height = oForm.Height - 10 - oForm.Exporter.Height .Width = oForm.Width - 10 .Left = 5 .Top = 5 + oForm.Exporter.Height .ControlSource = "testgen.graphtest" .Object.Application.plotby = xlRows .ChartGroups(1).Gapwidth = 0 With .Axes(xlCategory).TickLabels With .Font .Name = "Arial" .FontStyle = "Normal" .Size = 8 Endwith .Offset = 50 .Orientation = 90 Endwith Endwith .FormatGraph(.myGraph,xlColumnClustered,; 'Customer Sales by Employee',; 'Customer Country',0,; 'Number of Customers',90,; 'Employee Name',0) .myGraph.Visible=.T. Endwith Wait Clear **** Set the LocaleId to the previous value =Sys(3006,Val(nlLocaleId)) Read Events Define Class myForm As Form Width=800 Height=600 Name='MyForm' BackColor = Rgb(255,255,196) Procedure QueryUnload Clear Events Endproc Procedure FormatGraph Lparameters oGraph,tnChartType, tcChartTitle, ; tcCategoryTitle, tnCategoryRotation, ; tcValuesTitle, tnValuesRotation, ; tcSeriesTitle, tnSeriesRotation With oGraph .ChartType = tnChartType .hastitle = .T. .haslegend = .T. With .Legend.Font .Bold = .F. .Size = 8 Endwith .Legend.Position = xlRight With .ChartTitle .Caption = tcChartTitle .Shadow = .T. With .Border .Weight = xlHairline .LineStyle = xlAutomatic Endwith With .Font .Size = 12 .Background = xlBackgroundTransparent Endwith Endwith With .Axes(xlCategory).TickLabels .Font.Size = 8 .Orientation = xlTickLabelOrientationAutomatic Endwith *!* With .SeriesCollection(1) *!* .HasDataLabels = .T. *!* .DataLabels.Font.Size = 8 *!* EndWith * Set axis titles This.FormatAxis(oGraph,xlCategory, tcCategoryTitle,tnCategoryRotation) && Set axis titles This.FormatAxis(oGraph,xlValue, tcValuesTitle, tnValuesRotation) With .Axes(xlValue).TickLabels .Font.Size = 8 .Orientation = xlTickLabelOrientationAutomatic Endwith If .Axes.Count > 2 && Otherwise illegal operation (if chart is not 3D) This.FormatAxis(oGraph,xlSeriesAxis, tcSeriesTitle,tnSeriesRotation) With .Axes(xlSeriesAxis).TickLabels .Font.Size = 8 .Orientation = xlTickLabelOrientationAutomatic Endwith Endif Endwith Endproc Procedure FormatAxis Lparameters toGraph, tnAxis, tcCaption, tnOrientation, tcFontName, ; tnFontSize, tlBold, tlItalic, tlUnderline If Type("tcCaption") = "C" And !Empty(tcCaption) ; and Type("toGraph.Axes(tnAxis)") = "O" && Not empty title and axis is a supported type If Type("tnOrientation") # "N" tnOrientation = 0 Endif If Type("tcFontName") # "C" Or Empty(tcFontName) tcFontName = "Arial" Endif If Type("tnFontSize") # "N" tnFontSize = 10 Endif With toGraph.Axes(tnAxis) .hastitle = .T. With .AxisTitle .Caption = tcCaption .Orientation = tnOrientation With .Font .Name = tcFontName .Size = tnFontSize .Bold = tlBold .Italic = tlItalic .Underline = tlUnderline .Background = xlBackgroundTransparent Endwith Endwith Endwith Endif Endproc Enddefine Define Class Exporter As CommandButton Top =0 Left = 70 Caption = 'Export' Procedure Click && Export to 4 different file formats lcFormats = 'TIF,GIF,PNG,JPG' lcFileName = 'c:\Temp\myExport' lnFormats = Alines(arrFormats,lcFormats,.T.,',') For ix=1 To lnFormats Thisform.myGraph.Object.Export(; Forceext(lcFileName,arrFormats[ix]),arrFormats[ix]) Endfor Endproc EnddefineMSGraph object model is almost the same as Excel Chart object model. IOW you could use Excel help or MSgraph help for PEM (not 100% but in general).