s-news
[Top] [All Lists]

graph

To: s-news@lists.biostat.wustl.edu
Subject: graph
From: "Smeets, S (Sjoerd)" <S.Smeets@Interpolis.nl>
Date: Fri, 17 Sep 2004 15:29:24 +0200
Thread-index: AcSculjmIrzBQ+09QKGS6QilAXPXgg==
Thread-topic: graph

Hi,

I have got a function that exports graphs to excel. want to export files that are made using the function guiPlot but this doesn´t work for some reason. They are stored in an other object: the plots in the example in GSD2 and the guiPlots in GS1. Then I looked in the Programmers guide to S-plus but I can not find a way to make a bar y min base plot using a function.

Could you tell me how to proceed so that the exporting to excel will work?

My current graphs are created in the following way:

guiPlot( PlotType = "Bar Y Min Base", DataSet = "d1.subsubobject", Columns =
"1,4")
guiCreate( "LinePlot", Name = "GS1$1$2",LineStyle = "Solid",
BreakOnSlopeTransition = "None",        SymbolStyle = "Triangle, Up, Empty",
SymbolFreq = "0",       SmoothingType = "None", ConnectLineType = "Direct",
VarySymbolText = "Specified Text",      VarySymbolSizeType =
"None",VarySymbolColorType = "None",    NumberOfColors = "16",  TimeSeries =
F,      DotPlot = F)
guiModify( "LinePlot", Name = "GS1$1$2",DataSet="d1.subsubobject",
xColumn = "1",  yColumn = "7",  RelativeAxisY = "2",LineColor =
"Blue",SymbolStyle = "Diamond, Solid",  SymbolColor = "Blue",   SymbolFreq =
"1",    UseTextAsSymbol = F)
guiCreate( "Legend", Name = "GS1$1$1",xPosition = "4",  yPosition = "8",
UseAxesUnits = F)
guiModify( "GraphSheet", Name = "GS1",NewName = "d1.subsubobject.freq") guiCreate( "MainTitle", Name = "d1.subsubobject.freq$1$1",Title = "@Auto",

FillColor = "Transparent",      xPosition = "0.303297", yPosition = "7.61538"
)

And is it also possible to let the axis of the lineplot (RelativeAxisY) start at the value 0 and end at the value 10?


The export to excel function look like the following:

GraphsToExcel <- function(g.files) {
#### Insightful 2004



# Function to save a workbook in Excel under a new name
# Create an instance of Excel
pExcel <- create.ole.object( "excel.application" )

ExcelVisible <- get.ole.property( pExcel, "visible" )$visible
# If running from console!
if ( !ExcelVisible ) set.ole.property( pExcel, list( visible=T ) )

pWorkBooks <- get.ole.property( pExcel, "workbooks" )[[1]]
pNewBook <- call.ole.method( pWorkBooks, "Add" )
pSheets <- get.ole.property( pExcel, "Sheets" )
sheet=1



for (sheet in 1:length(g.files)){

# This adds a new sheet to excel!
       

#       Just let the file system catch up!
        sleep(1)

        call.ole.method( pSheets$She, "Add")
        pActiveSheet <- get.ole.property( pExcel, "ActiveSheet" )[[1]]
        call.ole.method(pActiveSheet, "Select")
        set.ole.property( pActiveSheet, list("name := abc"))   

        pShapes <- get.ole.property( pActiveSheet, "Shapes")
       
        #http://msdn.microsoft.com/library/default.asp?url="">
       
        pPicture  <- call.ole.method( pShapes$Shapes, "AddPicture",     GRAPHS[[sheet]], 1, 1, 0, 0, 400, 400)
       
        pFillFormat <- get.ole.property( pPicture, "Fill")
                call.ole.method( pFillFormat[[1]] , "Solid")
       
        release.ole.object( pFillFormat[[1]] )
        release.ole.object( pPicture )
        release.ole.object( pShapes[[1]] )
        release.ole.object( pActiveSheet )
}


# Quit Excel with no prompts

# release.ole.object( pRange )
        release.ole.object( pSheets[[1]] )
        release.ole.object( pNewBook )
        release.ole.object( pWorkBooks )
        release.ole.object( pExcel )

invisible()
}





Kind regards,

Sjoerd Smeets


================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en
de afzender direct te informeren door het bericht te retourneren.
================================================
The information contained in this message may be confidential
and is intended to be exclusively for the addressee. Should you
receive this message unintentionally, please do not use the contents
herein and notify the sender immediately by return e-mail.

<Prev in Thread] Current Thread [Next in Thread>
  • graph, Smeets, S (Sjoerd) <=