WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: kdmoyers on October 31, 2014, 01:29:19 PM

Title: suggestions for making charts?
Post by: kdmoyers on October 31, 2014, 01:29:19 PM
I have a sudden need to generate charts from winbatch.  Can anyone report sucess with some kind of charting tool?

notes:

I was considering GNUPlot command line tool, but I was hoping maybe for some kind of COM library, if someone had good experience with it.

Thanks in advance,
Kirby
Title: Re: suggestions for making charts?
Post by: kdmoyers on October 31, 2014, 01:30:42 PM
I had been using Google Image Charts, but that is deprecated and sunsetting soon.
Title: Re: suggestions for making charts?
Post by: stanl on November 01, 2014, 06:17:15 AM
If the PC's have MDAC 2.5 or higher (which comes with the OS) you can still download OWC tools for free and create very nice Excel charts - even w/out Office installed. 

Plan-B:  Use OpenOffice; it has a COM Interface (albeit limited)

If you search the Tech DB for 'OWC' or 'OpenOffice' you will find some code to get you started.
Title: Re: suggestions for making charts?
Post by: stanl on November 03, 2014, 07:09:48 AM
Oh, I forgot Plan-C - LogParser can produce basic charts (althought it uses OWC as the backend).
Title: Re: suggestions for making charts?
Post by: td on November 03, 2014, 07:20:08 AM
There are a half-dozen or so Stan authored  Logparser examples in the Tech Database as well.
Title: Re: suggestions for making charts?
Post by: kdmoyers on November 06, 2014, 09:47:37 AM
Thanks everyone!  I did take a look at OWC, thanks.

I ended up with a scheme where I embed GNUPlot control data into the SQL query itself. 

My winbatch program
* runs the queries in the sql file producing a results file
* parses out the GNUPlot commands using BinaryTagXxxx 
* runs GNUPlot using the result query data
* inserts an IMG tag reference to the resulting image file
* repeat for next the next GNUPlot command
* writes the final product as an html file.
* handles internal workflow routing of the html file

The main thing for me is, the machine that runs this needs nothing in particular installed.  All pieces are plain network installed exes, so anyone can run it with no local setup.

The other nice thing is, the code to produce the data and the code to format the chart it are next to one another in the same file.  Tidy!

Also, GNUPlot is incredibly sophisticated.  This will easily handle anything I can throw at it and more.  I'm really interested in the smoothing functions.

If anyone sincerely wants it, I can produce a version of the code with the site-specific stuff commented out.  It wouldn't run, but it would demonstrate the idea if you wanted to implement it yourself. 

-Kirby
Title: Re: suggestions for making charts?
Post by: td on November 06, 2014, 01:09:48 PM
Might be something to put in the Tech Database.
Title: Re: suggestions for making charts?
Post by: td on November 11, 2014, 07:33:06 AM
Depending on licensing constraints, GNUPlot might even make a good extender projects for the ambitious.
Title: Re: suggestions for making charts?
Post by: td on November 11, 2014, 09:10:36 AM
Not original nor particularly useful but it does demonstrate one possible way to display a chart on the fly using GNUPlot.

Code (winbatch) Select

ObjectClrOption("use", "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")

strProg = "C:\Program Files (x86)\gnuplot\bin\pgnuplot.exe"
objProcess = ObjectClrNew("System.Diagnostics.Process")
objProcess.StartInfo.FileName =strProg 
objProcess.StartInfo.Arguments = "-persist"           
objProcess.StartInfo.UseShellExecute = ObjectType("BOOL", 0)       
objProcess.StartInfo.RedirectStandardInput = ObjectType("BOOL",1) 
objProcess.Start()

objStream = objProcess.StandardInput
objStream.WriteLine(:'set title "Sine curve"':@LF)
objStream.WriteLine(:"plot sin(x)":@LF)
objStream.Flush()