Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a Chart
Message
From
20/07/2011 13:24:39
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01518660
Message ID:
01518682
Views:
39
>>Hi,
>>
>>I have this code:
>>
>>
LOCAL loxl as EXCEL.Application
>>
>>m.loxl = CREATEOBJECT("Excel.application")
>>m.loXLWorkbook = m.loxl.Workbooks.Add()
>>m.loxl.Visible = .t.
>>
>>m.loXL.ActiveSheet.Cells[1,1].VALUE = "Month"
>>m.loXL.ActiveSheet.Cells[2,1].VALUE = "Jan"
>>m.loXL.ActiveSheet.Cells[3,1].VALUE = "Feb"
>>m.loXL.ActiveSheet.Cells[4,1].VALUE = "Mar"
>>m.loXL.ActiveSheet.Cells[5,1].VALUE = "Apr"
>>m.loXL.ActiveSheet.Cells[6,1].VALUE = "May"
>>
>>m.loXL.ActiveSheet.Cells[1,2].VALUE = "Claims"
>>m.loXL.ActiveSheet.Cells[1,3].VALUE = "Turnaround"
>>
>>FOR i = 2 TO 6
>>	m.loXL.ActiveSheet.Cells[m.i,2].VALUE = m.i * 10
>>	m.loXL.ActiveSheet.Cells[m.i,3].VALUE = m.i - 1
>>ENDFOR
>>m.loSourceRange = m.loXL.Range("A1:C6")
>>
>>xlBuiltIn = 21
>>xlColumns = 2
>>xlLocationAsObject = 2
>>xlCategory = 1
>>xlPrimary = 1
>>xlValue = 2
>>xlSecondary = 2
>>xlUp = -4162
>>xl3DPie = -4102
>>xlLineMarkers = 65
>>
>>m.loChart = m.loXLWorkbook.Charts.Add()
>>				
>>m.loChart.ChartWizard(m.loSourceRange,  -4102, 4 , 2, 1, 0, .T., [Claims Received/Turnaround])
>>m.loChart.ApplyCustomType(xlBuiltIn, "Lines on 2 Axes")
>>m.loChart.HasTitle = .t.
>>m.loChart.ChartTitle.Characters.Text = "Claims Received/Turnaround"
>>m.loChart.Axes(xlCategory, xlPrimary).HasTitle = .T.
>>m.loChart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Month"
>>m.loChart.Axes(xlValue, xlPrimary).HasTitle = .T.
>>m.loChart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Claims Received"
>>m.loChart.Axes(xlCategory, xlSecondary).HasTitle = .T.
>>m.loChart.Axes(xlCategory, xlSecondary).AxisTitle.Characters.Text = ""
>>m.loChart.Axes(xlValue, xlSecondary).HasTitle = .T.
>>m.loChart.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "Avg. Turnaround"
>>
>>With m.loChart.Axes(xlCategory)
>>    .HasMajorGridlines = .F.
>>    .HasMinorGridlines = .F.
>>EndWith
>>With m.loChart.Axes(xlValue)
>>    .HasMajorGridlines = .T.
>>    .HasMinorGridlines = .F.
>>ENDWITH
>>
>>m.loXL.Visible = .T.
>>
>>which creates a chart in Excel.
>>
>>There are some things I don't know how to do, could someone please tell me how to:
>>
>>1. How do I get the chart to show the Lines on 2 Axes chart type by passing this into the ChartWizard call?
>>
>>2. How do I tell it to use the column headers as the labels for the axes instead of manually setting them?
>>
>>3. How do I change the size of the chart? I need to put this in a Word document and it is too big.
>
>
>Not sure if this could help you but check http://www.youtube.com/watch?v=qrp65AyCzuU and record a macro :-)
>or this:
>http://www.techonthenet.com/excel/charts/2_y_axes.php
>BTW ApplyCustomType didn't work in 2007 :o(
>(or at least here on my computer)

Hi Boris,

unfortunately I am using Office XP and don't have 2007 around. I tried recording a macro, but I can't see how to change the chart size.

qrp65AyCzuU
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform