>Dear All,
>
>I have tried to draw graph using excel object created within VFP program. However, I don't know how to use one of the columns displayed on x-axis, and how to change the style of the chart?
>(I have troubles putting down what I am thinking, and please refer to the scratch below. Thanks)
>
>|
>|
>|
>|
>|
>|
>|
>____________________________________________________
>A B C D E F G H.....
>
>Where A,B,C,D,... are the content of a column of a cursor.
>
>Best regards,
>Ron.
Hi Ron,
Currently I haven't reinstalled Excel after an upgrade to my hardware. But Excel and MSGraph5 routines are alike.
Here is sample code from solutions.app
oXLChart1 = GetObject('','excel.chart')
oXLChart1.application.visible = .t.
oXLChart1.application.worksheets(1).cells().clear
_cliptext = ""+TAB+"Cats"+TAB+"Dogs"+CRLF+;
"1994"+TAB+"11"+TAB+"22"+CRLF+;
"1995"+TAB+"33"+TAB+"44"+CRLF+;
"1996"+TAB+"55"+TAB+"55"+CRLF
oXLChart1.application.worksheets(1).cells(1,1).pastespecial
oXLChart1.autoformat(11,1)
* Remove extra series added by Excel
nTotSeries = oXLChart1.SeriesCollection().count
FOR i = m.nTotSeries to 4 STEP -1
oXLChart1.SeriesCollection(m.i).delete
ENDFOR
Here :
You can add parameters as.
oXLChart1.haslegend = .t. && Creates a legend
oXLChart1.hastitle = .t. && Creates a chart title
oXLChart1.ChartTitle.text = "Chart Title". && Chart Title and so on.
oXLChart1.autoformat(11,1) determines the style of chart. 11 is the chart type and 1 is first subtype in that chart type. To find out the types, create a chart in excel and than select chart types. Enumerate them starting with 1 for main chart type and in every chart type you'll see the subtypes for second parameter. You can find detailed syntax in windows\msapps\msgraph5\vba_grp.hlp file.
Best regards
Cetin