POV-Ray : Newsgroups : povray.off-topic : A solution in search of a problem Server Time
28 Jul 2024 22:29:33 EDT (-0400)
  A solution in search of a problem (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Orchid Win7 v1
Subject: Re: A solution in search of a problem
Date: 23 Jun 2013 10:13:17
Message: <51c7027d@news.povray.org>
>> Anyway, I think I've hit upon a problem which COM might actually be able
>> to solve... Can I use COM to transfer some numbers into Excel and get
>> them graphed? And if so, how might I go about doing that?
>>
>> (The alternative is to use GNUplot. But it does draw particularly ugly
>> graphs, and it's awkward and unintuitive to use...)
>>
>
> why not simply Metapost?
>
> or POV?

Well, yeah, I could go reinvent the wheel... or I could quickly utilise 
something that already exists.

There are plenty of other possibilities too - Google Charts, for 
example. What none of these let you easily do is go back into the 
spreadsheet and tweak the data.

Currently my program spits out a CSV file, which I then open in Excel, 
manually select the range of cells I want, manually step through the 
chart wizard, and now I've got a graph. It seems like there ought to be 
some way to automate that...


Post a reply to this message

From: Le Forgeron
Subject: Re: A solution in search of a problem
Date: 23 Jun 2013 10:29:31
Message: <51c7064b$1@news.povray.org>
Le 23/06/2013 16:13, Orchid Win7 v1 nous fit lire :
> Well, yeah, I could go reinvent the wheel... or I could quickly utilise
> something that already exists.
> 
> There are plenty of other possibilities too - Google Charts, for
> example. What none of these let you easily do is go back into the
> spreadsheet and tweak the data.
> 

Ploticus, split your code from your data and the data is a separate (or
more) files, in space separated columns. Never touch the code again.
But mastering ploticus is not easy. (yet, that's what I use for my bank
accounts overview/balancing)

> Currently my program spits out a CSV file, which I then open in Excel,
> manually select the range of cells I want, manually step through the
> chart wizard, and now I've got a graph. It seems like there ought to be
> some way to automate that...

Excel... isn't there some macro language in that flipper ? (or is it a
flight simulator ? or doom-like ?)


Post a reply to this message

From: Stephen
Subject: Re: A solution in search of a problem
Date: 23 Jun 2013 11:04:43
Message: <51c70e8b$1@news.povray.org>
On 23/06/2013 3:29 PM, Le_Forgeron wrote:
> Excel... isn't there some macro language in that flipper ? (or is it a
> flight simulator ? or doom-like ?)

Yes there is. Andrew can record a macro then either edit it to be able 
to change the name of the file of keep the name of the input file the same.

Sample code:


Sub Macro6()
'
' Macro6 Macro
'

'
     Columns("A:B").Select
     With ActiveSheet.QueryTables.Add(Connection:= _
         "TEXT;C:\Users\Stephen\Documents\Book2.csv", 
Destination:=Range("$A$1"))
         .Name = "Book2_1"
         .FieldNames = True
         .RowNumbers = False
         .FillAdjacentFormulas = False
         .PreserveFormatting = True
         .RefreshOnFileOpen = False
         .RefreshStyle = xlInsertDeleteCells
         .SavePassword = False
         .SaveData = True
         .AdjustColumnWidth = True
         .RefreshPeriod = 0
         .TextFilePromptOnRefresh = False
         .TextFilePlatform = 850
         .TextFileStartRow = 1
         .TextFileParseType = xlDelimited
         .TextFileTextQualifier = xlTextQualifierDoubleQuote
         .TextFileConsecutiveDelimiter = False
         .TextFileTabDelimiter = True
         .TextFileSemicolonDelimiter = False
         .TextFileCommaDelimiter = True
         .TextFileSpaceDelimiter = False
         .TextFileColumnDataTypes = Array(1, 1)
         .TextFileTrailingMinusNumbers = True
         .Refresh BackgroundQuery:=False
     End With
     ActiveSheet.Shapes.AddChart.Select
     ActiveChart.ChartType = xlXYScatterLinesNoMarkers
     ActiveChart.SetSourceData Source:=Range("Sheet4!$A:$B")
End Sub


-- 
Regards
     Stephen


Post a reply to this message

From: scott
Subject: Re: A solution in search of a problem
Date: 24 Jun 2013 03:11:40
Message: <51c7f12c$1@news.povray.org>
> [* Particularly those of you who happen to be Darren.]

Haven't noticed him around for a while now.

> Anyway, I think I've hit upon a problem which COM might actually be able
> to solve... Can I use COM to transfer some numbers into Excel and get
> them graphed? And if so, how might I go about doing that?

Is this in C#? If so you need to look at Microsoft.Office.Interop.Excel 
- the VS help and google will get you started using it, it's very easy 
to do.

> (The alternative is to use GNUplot. But it does draw particularly ugly
> graphs, and it's awkward and unintuitive to use...)

Mind you Excel's graphs are pretty yucky by default (although the newer 
Office versions seem to have improved this).

If you /are/ on C# and using Windows forms then don't forget you've got 
built in DataVisualization.Charting which can be used to quickly add a 
charting capabilities to your program.


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: A solution in search of a problem
Date: 26 Jun 2013 13:21:16
Message: <51cb230c$1@news.povray.org>
On 23/06/2013 04:04 PM, Stephen wrote:
> On 23/06/2013 3:29 PM, Le_Forgeron wrote:
>> Excel... isn't there some macro language in that flipper ? (or is it a
>> flight simulator ? or doom-like ?)
>
> Yes there is. Andrew can record a macro then either edit it to be able
> to change the name of the file of keep the name of the input file the same.
>
> Sample code:

How would you execute that from outside Excel though?


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: A solution in search of a problem
Date: 26 Jun 2013 13:23:12
Message: <51cb2380$1@news.povray.org>
On 24/06/2013 08:11 AM, scott wrote:
>> [* Particularly those of you who happen to be Darren.]
>
> Haven't noticed him around for a while now.

It seems awful quiet in this newgroup allround, really.

Then again, I now spend all day every day constantly writing code. I 
hardly seem to have time to do anything else with my life now...

>> Anyway, I think I've hit upon a problem which COM might actually be able
>> to solve... Can I use COM to transfer some numbers into Excel and get
>> them graphed? And if so, how might I go about doing that?
>
> Is this in C#? If so you need to look at Microsoft.Office.Interop.Excel
> - the VS help and google will get you started using it, it's very easy
> to do.

Actually this is Haskell. But if it isn't too difficult, I could write 
some C# to actually graph the data once it's in a CSV file...


Post a reply to this message

From: Stephen
Subject: Re: A solution in search of a problem
Date: 26 Jun 2013 13:33:17
Message: <51cb25dd@news.povray.org>
On 26/06/2013 6:21 PM, Orchid Win7 v1 wrote:
> On 23/06/2013 04:04 PM, Stephen wrote:
>> On 23/06/2013 3:29 PM, Le_Forgeron wrote:
>>> Excel... isn't there some macro language in that flipper ? (or is it a
>>> flight simulator ? or doom-like ?)
>>
>> Yes there is. Andrew can record a macro then either edit it to be able
>> to change the name of the file of keep the name of the input file the
>> same.
>>
>> Sample code:
>
> How would you execute that from outside Excel though?
>
Whoa! now you are changing the question and we all know change requests 
cost money.

So why would you want to execute it from outside excel when you will 
need to open excel to see the graph?

But because it is you I will hazard an answer. Make the macro a startup 
macro.

-- 
Regards
     Stephen


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: A solution in search of a problem
Date: 26 Jun 2013 15:36:34
Message: <51cb42c2$1@news.povray.org>
>> How would you execute that from outside Excel though?
>>
> Whoa! now you are changing the question and we all know change requests
> cost money.
>
> So why would you want to execute it from outside excel when you will
> need to open excel to see the graph?

Like I said, I've got a program that generates some data. I want to 
graph that data. Without having to manually press half a dozen buttons.

It's easy enough to open Excel programmatically; what isn't obvious is 
how to make it run code once it opens up. (Indeed, these days that tends 
to be exactly the sort of thing Excel blocks to prevent macro viruses...)


Post a reply to this message

From: Stephen
Subject: Re: A solution in search of a problem
Date: 26 Jun 2013 15:54:46
Message: <51cb4706$1@news.povray.org>
On 26/06/2013 8:36 PM, Orchid Win7 v1 wrote:
> It's easy enough to open Excel programmatically; what isn't obvious is
> how to make it run code once it opens up. (Indeed, these days that tends
> to be exactly the sort of thing Excel blocks to prevent macro viruses...)

http://office.microsoft.com/en-gb/excel-help/running-a-macro-when-excel-starts-HA001034628.aspx


-- 
Regards
     Stephen


Post a reply to this message

From: scott
Subject: Re: A solution in search of a problem
Date: 27 Jun 2013 03:58:51
Message: <51cbf0bb$1@news.povray.org>
> Actually this is Haskell. But if it isn't too difficult, I could write
> some C# to actually graph the data once it's in a CSV file...

Seems a bit of an overkill if you don't already have a C# app running.

If you don't mind it being in Excel then that would be the easiest way 
to go, as already discussed here. Haskell writes CSV to known file, 
fires up a "template" Excel file that has an onload macro to import the 
csv. You might also want to reset the filename so the user doesn't 
accidentally overwrite your template.

If you don't want to use macros then you could use COM to open up the 
Excel file and then put the data directly into the Excel file (rather 
than writing it to a csv first). Don't know if this is possible in 
Haskell, in C# something like this will work:

Excel.Application app = new Excel.Application();
app.Workbooks.Open(@"C:\tem### [at] exls")
app.Cells[5,5] = 500
...


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.