suggestions for making charts?

Started by kdmoyers, October 31, 2014, 01:29:19 PM

Previous topic - Next topic

kdmoyers

I have a sudden need to generate charts from winbatch.  Can anyone report sucess with some kind of charting tool?

notes:

  • the relevant machines do not have any kind of MS office package installed
  • need line charts and bar charts
  • need more than one data series per chart
  • need to output a image file (png or jpg) for later inclusion in an html report
  • reasonable license fees are OK

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
The mind is everything; What you think, you become.

kdmoyers

I had been using Google Image Charts, but that is deprecated and sunsetting soon.
The mind is everything; What you think, you become.

stanl

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.

stanl

Oh, I forgot Plan-C - LogParser can produce basic charts (althought it uses OWC as the backend).

td

There are a half-dozen or so Stan authored  Logparser examples in the Tech Database as well.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

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
The mind is everything; What you think, you become.

td

Might be something to put in the Tech Database.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Depending on licensing constraints, GNUPlot might even make a good extender projects for the ambitious.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

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()
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade