General information
Category:
COM/DCOM and OLE Automation
Title:
Excel Column Graph Color Selection
I have included some code I have used to create a column graph in using Excel through VFP. I included it so you can see how I did things and it may help you answer this question: I have a graph with all of the columns being the same color. I would like to change the color of the column on the extreme right to something else. I also would like to have the bars be a little wider.
I know how to do this from within Excel and I have created a macro while doing it. However, I am still unable to find the correct syntax to accomplish this using VFP coding. Given my code below, does anyone have any suggestions ?
if thisform.chkGraph.value
if rptSingleMonth
rptMonth = cmonth(dStart)
if openTable("TECHGOAL")
count to nRecs
cBottomRow = alltrim(str(nRecs+1,10,0))
cRange = "A2:A"+cBottomRow+",D2:D"+cBottomRow
copy to TECHGOAL type XL5
use
release all like o*
oExcel = createObject("Excel.Application")
oBook = oExcel.Workbooks.Open(currentLoc()+"\techgoal.xls")
oExcel.visible = .t.
oPlotRange = oBook.Sheets[1].Range(cRange)
oChart = oBook.Charts.Add()
oChart.ChartWizard(oPlotRange)
oChart.HasLegend = .f.
oChart.HasTitle = .t.
oChart.ChartTitle.Characters.Text="SERVICE DEPARTMENT"+chr(13)+rptMonth+" Performance"+chr(13)+dtoc(dStart)+" - "+dtoc(dEnd)+chr(13)+"Print Date: "+dtoc(date())
oChart.Axes(2,1).HasTitle = .t.
oChart.Axes(2,1).AxisTitle.Characters.Text = "Percent of goal"
with oChart.Axes(2,1)
.MinimumScaleIsAuto = .t.
.MaximumScale = 100
.MinorUnitIsAuto = .t.
.MajorUnit = 10
endwith
oChart.PlotArea.Interior.ColorIndex = 2
endif
endif
endif
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only