Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Graphs
Message
From
16/04/2003 05:11:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
16/04/2003 04:24:12
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Re: Graphs
Miscellaneous
Thread ID:
00778229
Message ID:
00778235
Views:
17
>Hello everyone,
>
>I have to fill a graph in Excel with data. But I do not know how I can do it.
>The code I have until now is:
>
>#DEFINE xlEdgeBottom 9
>#DEFINE xlMedium -4138
>#DEFINE xlLandScpae 2
>#DEFINE xlWorkBookNormal -4143
>#DEFINE xlBar 2
>
>oExcel=CREATEOBJECT("Excel.Application")
>oWorkBook=oExcel.WorkBooks.Open(m_excelbestand)
>
>FOR m_teller=1 TO 4
> oWorkBook.ActiveSheet.Rows(1).Insert
>ENDFOR
>
>oWorkBook.ActiveSheet.Range("A5:J5").Font.Bold=.T.
>oWorkBook.ActiveSheet.Range("A5:J5").Borders(xlEdgeBottom).Weight=xlMedium
>
>FOR m_teller=4 TO m_fieldcount
> m_cel='"'+CHR(64+m_teller)+ALLTRIM(STR(m_regelnr))+'"'
> m_formule="="+CHR(64+m_teller)+ALLTRIM(STR(m_regelnr-1))+;
> "/("+CHR(67)+ALLTRIM(STR(m_regelnr-1))+;
> "/100)"
> oWorkBook.ActiveSheet.Range(&m_cel).Value=m_formule
>ENDFOR
>
>OWorkBook.ActiveSheet.Range("A1:Z200").Columns.Autofit()
>
>oWorkSheet1=oWorkBook.WorkSheets[1]
>oGraphSheet=oWorkBook.WorkSheets.Add(,oWorkSheet1)
>
>oWorkBook.WorkSheets["Blad1"].Name="Grafiek"
>
>oChart=oExcel.Sheets[2].ChartObjects.Add(45.7, 173.2, 319.5, 190.5)
>oChart.Activate()
>
>[Here I have to fill the graph with data from another sheet........]
>
>oExcel.DisplayAlerts=.F.
>oExcel.ActiveSheet.SaveAs(m_excelbestand, xlWorkBookNormal)
>oWorkBook.Save()
>oExcel.Quit()
>RELEASE oExcel
>
>Can anybody please tell me how I can give the range of data and the type of graph and maybe other parameters that I need?
>
>Thanx in advance
>Ron :o)

Hi Ron,
You could either create the chat with ChartWizard at once or later set data source :
   oChart = .ChartObjects.Add(200, 200, 500, 200)
   oChart.Chart.chartwizard(.Range(.Cells(1,1),.Cells(4,3)), ;
        xl3DColumn,4,1,0,1,1,"","","","")

* Set data source
  oChart.Chart.SetSourceData(.Range(.Cells(3,3),.Cells(8,6)),xlColumns)
OWorkBook.ActiveSheet.Range("A1:Z200").Columns.Autofit()

oWorkSheet1=oWorkBook.WorkSheets[1]
oGraphSheet=oWorkBook.WorkSheets.Add(,oWorkSheet1)

oWorkBook.WorkSheets["Blad1"].Name="Grafiek"

oChart=oExcel.Sheets[2].ChartObjects.Add(45.7, 173.2, 319.5, 190.5)


*[Here I have to fill the graph with data from another sheet........]
#define xlColumns  2
oChart.Chart.SetSourceData(oWorkSheet1.Range("A1:Z200"),xlColumns)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform