LPARAMETERS toWord, toDoc, tcFileName m.lcChartFile = FORCEEXT(m.tcFileName + "-Expense", "PNG") LOCAL loFoxChart as FoxCharts OF "FoxCharts.vcx" m.loFoxChart = NEWOBJECT("FoxCharts", "FoxCharts.vcx") CREATE CURSOR c_Chart (nValue n(8,2) null, Legend c(30), Color i, Detach l, Hide l) INSERT INTO c_Chart ; SELECT ExpenseAmount, typ_name, 0, .T., .F. FROM c_ExpenseBreakdown order by ExpenseAmount desc WITH m.loFoxChart as FoxCharts OF "FoxCharts.vcx" .PieDetachPixels = 50 .ChartsCount = 1 .ChartType = 1 .Depth = 30 && the 3D effect - 0 = plain chart * Inform the class where the data will be found .SourceAlias = "c_Chart" .FieldAxis2 = "Legend" && name of the field * .FieldColor = "Color" && name of the field - used when you choose custom colors .FieldLegend = "Legend" && name of the field .Fields(1).FieldValue = "nValue" * Setting the captions for the other legends .Title.Caption = "Claims Expense Breakdown" .Subtitle.Caption = "" * The backcolor .BackColor = RGB(0,0,0) && black * Setting the colors .ColorType = 2 && 0=basic, 1=custom, 2=Random colors .Title.ForeColor = RGB(255,255,255) .SideLegend.ForeColor = RGB(255,255,255) .ShowValuesOnShapes = .T. .LegendPosition = 8 .DrawChart() && update the chart with the current settings .SaveToFile(m.lcChartFile, 100) ENDWITH this.AddChartToWord(m.toWord, m.toDoc, "ExpenseChart", m.lcChartFile) RETURN