473,382 Members | 1,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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::ofstream 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!
Jun 27 '08 #1
7 2912
zd***********@gmail.com 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::ofstream 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?
Generating HTML as output is actually nice. However, C++ has no means
to do that, built-in. I would recommend looking in the archives for
"The Available C++ Libraries FAQ" (if the list is still maintained, of
course, I've not seen that posting from Nikki Locke in a very long
while). As to dynamic HTML, ask in 'comp.infosystems.www.*' newsgroup
hierarchy, there has to be some place where all dynamic HTML folks
gather to discuss the tools and libraries they use. I am fairly certain
that there exist the libraries with C++ bindings.
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?
Again, there is probably the newsgroup for discussing Excel and hot to
program it. Look for "excel" in the name. I would however recommend
against Excel, you can do better with other vector formats, like SVG or
XAML. I've also seen people using gnuplot for vector output. I once
used DXF for some scientific plotting because the target was AutoCAD,
although it is relatively old and many applications can import those.
Depending on what you choose you will find different libraries for
working with those formats.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
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::ofstream 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
Jun 27 '08 #3
In article <40435691-5738-4df3-8dfe-e81de017e9fa@
2g2000hsn.googlegroups.com>, zd***********@gmail.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::ofstream 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.
Jun 27 '08 #4
Jerry Coffin <jc*****@taeus.comwrote in
news:MP************************@news.sunsite.dk:
In article <40435691-5738-4df3-8dfe-e81de017e9fa@
2g2000hsn.googlegroups.com>, zd***********@gmail.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::ofstream 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.
Another possibility (in case the output becomes more complex than a
simple table of numbers) would be to incorporate some XML library
(TinyXML is the simplest AFAIK), construct the HTML in a memory as a XML
tree and finally let the library to stream out the <htmlnode to a
file. Makes the process a bit more structured. Beware that some legal
XML constructs like e.g. <table/ might not be well supported by the
web browsers or other HTML processing software.

hth
Paavo
Jun 27 '08 #5
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.netwrote:
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::ofstream 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
Jun 27 '08 #6
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.netwrote:
>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::ofstream 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
Jun 27 '08 #7
Lionel B wrote:
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.netwrote:
>>>[..]

Anyway, what's this got to do with my reply?
Yours was probably the last one zdravko had read by the time he decided
to reply to some other post... <g>

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Erik Lechak | last post by:
Hello All, I am creating a visual programming environment for python (similar to Matlab's simulink, but for python). For several reasons I have decided not to go with OGL. I am writing a wxOGL...
4
by: skorpio11 | last post by:
Hi, I've been having some problems trying some basic plotting commands with gnuplot.py. My setup is the Python 2.3 Enthought edition and my script looks as: from scipy import * from scipy...
12
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time...
1
by: Edward | last post by:
ASP.NET SQL Server 2k Our clients need to output a pretty complicated Consignment/Delivery Note from their system. It is in tabular form, but each row can have a) a different number of...
3
by: maylee21 | last post by:
hi, anyone can help me figure out how to read data from a text file like this: 10980012907200228082002 and extract the data according to this kind of format: Record type 1 TY-RECORD ...
38
by: Sanders Kaufman | last post by:
I'm converting my table-based layouts to css-positioned divs - but the ONLY reason I'm doing it is because it's *considered* a best practice. I don't really see where anything goes hinky when...
5
by: Lars Eighner | last post by:
Is a calendar tabular data, logically meriting table markup? -- Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner> Countdown: 465 days to go. What do you do when...
1
by: sharan | last post by:
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 using C language. i am getting ouput serially but not in...
3
scubak1w1
by: scubak1w1 | last post by:
Hello, I am wanting a "pretty output" of tabular data generated on the fly and saved in an array (PHP)... That is, I have a link so users can chart (JpGraph) and download (CSV) tabular data,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.