Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Tabular output and plotting 2d/3d data in C++

Reply
Thread Tools

Tabular output and plotting 2d/3d data in C++

 
 
Guest Guest is offline
Junior Member
Join Date: Feb 2010
Posts: 27
 
      05-20-2008
Hi there!
I need a C++ library that can organize and write scientific (and
numerical overall) data in tables. I have been fighting with
std:fstream and plain ASCII files, but it is difficult to position
columns by an offset, impossible to draw table borders etc. I am
currently thinking of a class that is able to write to an html file,
e.g. As far as I know, html offers much better text (and table)
layout. And the format is portable! What I need is a C++ facility to
automate the generation process. It doesn't need to be html
necessarily - as long as the output is nice, it will be ok. Even a pdf
file could suit me. Any ideas?
The next question: I also need to plot some scientific data. Say, I
need the graphics in a vector format and not a raster pixels. I might
consider importing the data in Excel for later editing, e.g. What C++
library can do that?

Thanks in advance!
 
Reply With Quote
 
 
 
 
Lionel B
Guest
Posts: n/a
 
      05-20-2008
On Tue, 20 May 2008 08:48:02 -0700, zdravko.monov wrote:

> Hi there!
> I need a C++ library that can organize and write scientific (and
> numerical overall) data in tables. I have been fighting with
> std:fstream and plain ASCII files, but it is difficult to position
> columns by an offset, impossible to draw table borders etc. I am
> currently thinking of a class that is able to write to an html file,
> e.g. As far as I know, html offers much better text (and table) layout.
> And the format is portable! What I need is a C++ facility to automate
> the generation process. It doesn't need to be html necessarily - as long
> as the output is nice, it will be ok. Even a pdf file could suit me. Any
> ideas?


This is, I think, somewhat OT (this newsgroup deals specifically with C++
*language* issues, rather than [non-standard] libraries), but anyway...

Tables and formatted output in html are pretty simple - I can't see it'd
be much of a problem just to write out the appropriate html from your
(C++, whatever) program.

Another option would be to figure out how to do tables in LaTeX, get your
program to chug out the appropriate LaTeX source (which is also just
plain text) and then run pdflatex on it for pdf output.

Depends what you want, really.

> The next question: I also need to plot some scientific data. Say, I need
> the graphics in a vector format and not a raster pixels.


I can highly recommend Gnuplot http://www.gnuplot.info/ for scientific
plotting. It's very powerful, does many graphics formats, bitmapped &
vector (including Postscript, pdf, SVG, ...) and if your platform
supports pipes you can pipe commands to it programmatically; or even if
you can't do that, you can just write data files and command scripts from
your program - I do this all the time).

> I might
> consider importing the data in Excel for later editing, e.g. What C++
> library can do that?


Urgh to Excel :-/, but Gnuplot accepts ASCII data which you can edit in
any text editor.

Cheers,

--
Lionel B
 
Reply With Quote
 
 
 
 
Jerry Coffin
Guest
Posts: n/a
 
      05-21-2008
In article <40435691-5738-4df3-8dfe-e81de017e9fa@
2g2000hsn.googlegroups.com>, says...
> Hi there!
> I need a C++ library that can organize and write scientific (and
> numerical overall) data in tables. I have been fighting with
> std:fstream and plain ASCII files, but it is difficult to position
> columns by an offset, impossible to draw table borders etc. I am
> currently thinking of a class that is able to write to an html file,
> e.g. As far as I know, html offers much better text (and table)
> layout. And the format is portable! What I need is a C++ facility to
> automate the generation process. It doesn't need to be html
> necessarily - as long as the output is nice, it will be ok. Even a pdf
> file could suit me. Any ideas?


As far as C++ cares, HTML is just a text file with some slightly unusual
contents.

If the format you're going to use is relatively fixed, so you don't mind
encoding its overall structure into the structure of your code, you can
pretty easily create some objects that emit an opening HTML tag in their
ctor, and a matching closing tag in their dtor.

Another alternative is to create some stream manipulators that emit HTML
tags as needed. You can either create separate manipulators for the
open/close tags, or you can create a manipulator that takes a parameter,
and encloses its parameter within the appropriate open/close tags.

> The next question: I also need to plot some scientific data. Say, I
> need the graphics in a vector format and not a raster pixels. I might
> consider importing the data in Excel for later editing, e.g. What C++
> library can do that?


If you want to export the data for reading by Excel, the obvious way
would be to emit a file of comma separated values. Reading CSV files is
a bit of a pain, but writing them is pretty trivial -- you basically
convert any embedded quote to a pair of quotes, enclose each value in
quotes, and put commas between the quoted fields. The hardest part is
probably keeping track of ends of lines and assuring you only put a
comma _between_ fields, not after the last field on a line.

A CSV file basically just includes your raw data, and it's up to the
user to pick the appropriate type of plot in Excel (or whatever). If you
know much about your data, you might be able to save your user trouble
by having your program specify plot types more directly. In this case,
something like gnuplot might be considerably easier to use in the long
term.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
Guest Guest is offline
Junior Member
Join Date: Feb 2010
Posts: 27
 
      05-21-2008
I wonder why no one mentioned http://www.xportpro.com/
???
Why? Do you think I am going to reinvent the wheel? These libraries
are written to be used, not to be hidden!




On May 20, 6:42 pm, Lionel B <m...@privacy.net> wrote:
> On Tue, 20 May 2008 08:48:02 -0700, zdravko.monov wrote:
> > Hi there!
> > I need a C++ library that can organize and write scientific (and
> > numerical overall) data in tables. I have been fighting with
> > std:fstream and plain ASCII files, but it is difficult to position
> > columns by an offset, impossible to draw table borders etc. I am
> > currently thinking of a class that is able to write to an html file,
> > e.g. As far as I know, html offers much better text (and table) layout.
> > And the format is portable! What I need is a C++ facility to automate
> > the generation process. It doesn't need to be html necessarily - as long
> > as the output is nice, it will be ok. Even a pdf file could suit me. Any
> > ideas?

>
> This is, I think, somewhat OT (this newsgroup deals specifically with C++
> *language* issues, rather than [non-standard] libraries), but anyway...
>
> Tables and formatted output in html are pretty simple - I can't see it'd
> be much of a problem just to write out the appropriate html from your
> (C++, whatever) program.
>
> Another option would be to figure out how to do tables in LaTeX, get your
> program to chug out the appropriate LaTeX source (which is also just
> plain text) and then run pdflatex on it for pdf output.
>
> Depends what you want, really.
>
> > The next question: I also need to plot some scientific data. Say, I need
> > the graphics in a vector format and not a raster pixels.

>
> I can highly recommend Gnuplothttp://www.gnuplot.info/for scientific
> plotting. It's very powerful, does many graphics formats, bitmapped &
> vector (including Postscript, pdf, SVG, ...) and if your platform
> supports pipes you can pipe commands to it programmatically; or even if
> you can't do that, you can just write data files and command scripts from
> your program - I do this all the time).
>
> > I might
> > consider importing the data in Excel for later editing, e.g. What C++
> > library can do that?

>
> Urgh to Excel :-/, but Gnuplot accepts ASCII data which you can edit in
> any text editor.
>
> Cheers,
>
> --
> Lionel B


 
Reply With Quote
 
Lionel B
Guest
Posts: n/a
 
      05-22-2008
On Wed, 21 May 2008 13:47:14 -0700, zdravko.monov wrote:

[please don't top-post - re-arranged]

> On May 20, 6:42 pm, Lionel B <m...@privacy.net> wrote:
>> On Tue, 20 May 2008 08:48:02 -0700, zdravko.monov wrote:
>> > Hi there!
>> > I need a C++ library that can organize and write scientific (and
>> > numerical overall) data in tables. I have been fighting with
>> > std:fstream and plain ASCII files, but it is difficult to position
>> > columns by an offset, impossible to draw table borders etc. I am
>> > currently thinking of a class that is able to write to an html file,
>> > e.g. As far as I know, html offers much better text (and table)
>> > layout. And the format is portable! What I need is a C++ facility to
>> > automate the generation process. It doesn't need to be html
>> > necessarily - as long as the output is nice, it will be ok. Even a
>> > pdf file could suit me. Any ideas?

>>
>> This is, I think, somewhat OT (this newsgroup deals specifically with
>> C++ *language* issues, rather than [non-standard] libraries), but
>> anyway...
>>
>> Tables and formatted output in html are pretty simple - I can't see
>> it'd be much of a problem just to write out the appropriate html from
>> your (C++, whatever) program.
>>
>> Another option would be to figure out how to do tables in LaTeX, get
>> your program to chug out the appropriate LaTeX source (which is also
>> just plain text) and then run pdflatex on it for pdf output.
>>
>> Depends what you want, really.
>>
>> > The next question: I also need to plot some scientific data. Say, I
>> > need the graphics in a vector format and not a raster pixels.

>>
>> I can highly recommend Gnuplot http://www.gnuplot.info/for scientific
>> plotting. It's very powerful, does many graphics formats, bitmapped &
>> vector (including Postscript, pdf, SVG, ...) and if your platform
>> supports pipes you can pipe commands to it programmatically; or even if
>> you can't do that, you can just write data files and command scripts
>> from your program - I do this all the time).
>>
>> > I might
>> > consider importing the data in Excel for later editing, e.g. What C++
>> > library can do that?

>>
>> Urgh to Excel :-/, but Gnuplot accepts ASCII data which you can edit in
>> any text editor.
>>
>> Cheers,
>>
>> --
>> Lionel B


^^^^^^^^
[please don't quote signatures]

> I wonder why no one mentioned http://www.xportpro.com/ ???
> Why?


Because no-one that replied had heard of it, maybe?

> Do you think I am going to reinvent the wheel?


Dunno, you tell me.

> These libraries are written to be used, not to be hidden!


it was hidden? You found it.

Anyway, what's this got to do with my reply?

--
Lionel B
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple formatting of tabular output data with current methods murrayatuptowngallery Javascript 0 02-11-2008 08:23 AM
Want help on how we convert output to tabular format Using the expat parser (http://expat.sourceforge.net/) i have to parse the following xml file and print it on the screen in tabular format. sharan XML 1 10-26-2007 01:20 PM
how to read data in text file, extract and display in tabular manner in excel doc? maylee21@gmail.com C++ 3 06-20-2007 09:46 AM
Printing database output in tabular form ronrsr Python 5 11-13-2006 08:34 PM
live hyperlinks and Tabular Data Control (tdc) that ships with IE4.0. bobdedogh@ukonline.co.uk Javascript 4 06-15-2005 06:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57