comp.lang.ada
 help / color / mirror / Atom feed
* 2d graph
@ 2006-03-23 11:34 Anders Wirzenius
  2006-03-23 13:20 ` Dmitry A. Kazakov
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Anders Wirzenius @ 2006-03-23 11:34 UTC (permalink / raw)


I want to produce a 2d graph to be presented as an image on a HTML page.
Does anyone have an Ada example for, say, SVG?
The data is a textfile with x and y values on each line.
1.0   1.0
2.3   3.2
3.0   5.9
-- 
Anders



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
@ 2006-03-23 13:20 ` Dmitry A. Kazakov
  2006-03-23 13:40   ` Anders Wirzenius
  2006-03-23 14:04   ` Bobby D. Bryant
  2006-03-23 15:38 ` Jeffrey R. Carter
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 15+ messages in thread
From: Dmitry A. Kazakov @ 2006-03-23 13:20 UTC (permalink / raw)


On Thu, 23 Mar 2006 11:34:43 GMT, Anders Wirzenius wrote:

> I want to produce a 2d graph to be presented as an image on a HTML page.
> Does anyone have an Ada example for, say, SVG?
> The data is a textfile with x and y values on each line.
> 1.0   1.0
> 2.3   3.2
> 3.0   5.9

I did it in pure HTML, but it was designed for displaying fuzzy sets. The
output looked like:

0.0 |||||||||||||||
0.1 ||||||||
0.2 |||||||||||
0.3 ||||||||||||||||||||
0.4 ||||||||||||||||||||||

I think you got the idea. It is probably not what you want.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 13:20 ` Dmitry A. Kazakov
@ 2006-03-23 13:40   ` Anders Wirzenius
  2006-03-23 14:04   ` Bobby D. Bryant
  1 sibling, 0 replies; 15+ messages in thread
From: Anders Wirzenius @ 2006-03-23 13:40 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:


> 
> I did it in pure HTML, but it was designed for displaying fuzzy sets. The
> output looked like:
> 
> 0.0 |||||||||||||||
> 0.1 ||||||||
> 0.2 |||||||||||
> 0.3 ||||||||||||||||||||
> 0.4 ||||||||||||||||||||||
> 
> I think you got the idea. It is probably not what you want.
> 

Thanx and yes, that's not what I want. :(


I have sometimes used a <table> tag where the png images are 1x1 pixels
large (sorry for long lines):

<TABLE cellspacing=1 cellpadding=0>
<TR>

<TD valign="bottom">
<img src="../icons/AWI003.png" width="8px" height=" 8px" alt="12.08.2003: AWI003, 4 tickets"><br>
<img src="../icons/ITO001.png" width="8px" height=" 28px" alt="12.08.2003: ITO001, 14 tickets"><br>
<img src="../icons/MSO014.png" width="8px" height=" 44px" alt="12.08.2003: MSO014, 22 tickets"><br>
<img src="../icons/PWA006.png" width="8px" height=" 36px" alt="12.08.2003: PWA006, 18 tickets"><br>
<img src="../icons/RPU001.png" width="8px" height=" 14px" alt="12.08.2003: RPU001, 7 tickets"><br>
</TD>

<TD valign="bottom">
<img src="../icons/AWI003.png" width="8px" height=" 4px" alt="13.08.2003: AWI003, 2 tickets"><br>
<img src="../icons/ITO001.png" width="8px" height=" 4px" alt="13.08.2003: ITO001, 2 tickets"><br>
<img src="../icons/MSO014.png" width="8px" height=" 52px" alt="13.08.2003: MSO014, 26 tickets"><br>
<img src="../icons/PWA006.png" width="8px" height=" 28px" alt="13.08.2003: PWA006, 14 tickets"><br>
<img src="../icons/RPU001.png" width="8px" height=" 24px" alt="13.08.2003: RPU001, 12 tickets"><br>
</TD>

The png images i built using Stephen J. Sangwine's PNG_IO.

... but this time I want an image containing the graph.

-- 
Anders



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 13:20 ` Dmitry A. Kazakov
  2006-03-23 13:40   ` Anders Wirzenius
@ 2006-03-23 14:04   ` Bobby D. Bryant
  2006-03-24  7:03     ` Anders Wirzenius
  1 sibling, 1 reply; 15+ messages in thread
From: Bobby D. Bryant @ 2006-03-23 14:04 UTC (permalink / raw)


On Thu, 23 Mar 2006, "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

> On Thu, 23 Mar 2006 11:34:43 GMT, Anders Wirzenius wrote:
> 
>> I want to produce a 2d graph to be presented as an image on a HTML page.
>> Does anyone have an Ada example for, say, SVG?
>> The data is a textfile with x and y values on each line.
>> 1.0   1.0
>> 2.3   3.2
>> 3.0   5.9
> 
> I did it in pure HTML, but it was designed for displaying fuzzy sets. The
> output looked like:
> 
> 0.0 |||||||||||||||
> 0.1 ||||||||
> 0.2 |||||||||||
> 0.3 ||||||||||||||||||||
> 0.4 ||||||||||||||||||||||
> 
> I think you got the idea. It is probably not what you want.

You can do it with GtkAda (make the plot and spill to png), but that may
be overkill for what you want.

Does it need to be done in real time?  What role does Ada play, vs.
using R or gnuplot?

-- 
Bobby Bryant
Austin, Texas



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
  2006-03-23 13:20 ` Dmitry A. Kazakov
@ 2006-03-23 15:38 ` Jeffrey R. Carter
  2006-03-23 17:23 ` Jacob Sparre Andersen
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Jeffrey R. Carter @ 2006-03-23 15:38 UTC (permalink / raw)


Anders Wirzenius wrote:
> I want to produce a 2d graph to be presented as an image on a HTML page.
> Does anyone have an Ada example for, say, SVG?
> The data is a textfile with x and y values on each line.
> 1.0   1.0
> 2.3   3.2
> 3.0   5.9

You could paste the data into a spreadsheet, generate the graph in the 
spreadsheet, copy the graph, paste it into a graphics program, save it as an 
image, and link to that image in your HTML.

You could use Plot_Windows from Win_IO to generate the graph, capture the 
resulting window as an image, paste it into a graphics program, edit out any 
parts of the window you don't want, and continue as above.

-- 
Jeff Carter
"If I could find a sheriff who so offends the citizens of Rock
Ridge that his very appearance would drive them out of town ...
but where would I find such a man? Why am I asking you?"
Blazing Saddles
37



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
  2006-03-23 13:20 ` Dmitry A. Kazakov
  2006-03-23 15:38 ` Jeffrey R. Carter
@ 2006-03-23 17:23 ` Jacob Sparre Andersen
  2006-03-23 17:33 ` Alex R. Mosteo
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Jacob Sparre Andersen @ 2006-03-23 17:23 UTC (permalink / raw)


Anders Wirzenius wrote:

> I want to produce a 2d graph to be presented as an image on a HTML
> page.  Does anyone have an Ada example for, say, SVG?

I fear SVG isn't widely supported yet.  I have successfully used the
package PNG_IO for generating images in PNG format, but I haven't done
line graphics together with PNG_IO (yet).  You would have to put
together a simple line renderer, which prepares an image for PNG_IO to
save.

Jacob
-- 
"It's not a question of whose habitat it is,
 it's a question of how fast you hit it."



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
                   ` (2 preceding siblings ...)
  2006-03-23 17:23 ` Jacob Sparre Andersen
@ 2006-03-23 17:33 ` Alex R. Mosteo
  2006-03-23 17:57   ` tmoran
  2006-03-24  7:21   ` Anders Wirzenius
  2006-03-23 19:31 ` Gautier
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 15+ messages in thread
From: Alex R. Mosteo @ 2006-03-23 17:33 UTC (permalink / raw)


Anders Wirzenius wrote:
> I want to produce a 2d graph to be presented as an image on a HTML page.
> Does anyone have an Ada example for, say, SVG?
> The data is a textfile with x and y values on each line.
> 1.0   1.0
> 2.3   3.2
> 3.0   5.9

I have some packages for simple BMP drawing in memory. You can either 
serve the resulting file via AWS or write it to disk. There are 
functions for line/circle drawing.

https://svn.mosteo.com/public/Adagio%20head/src/agpl/agpl-bmp.ads
https://svn.mosteo.com/public/Adagio%20head/src/agpl/agpl-bmp-draw.ads

Apart from the other suggestions you have got, maybe you could use 
GtkAda to use all its drawing facilities in an off-screen buffer and 
then save that in some format known to GtkAda...



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 17:33 ` Alex R. Mosteo
@ 2006-03-23 17:57   ` tmoran
  2006-03-24  7:21   ` Anders Wirzenius
  1 sibling, 0 replies; 15+ messages in thread
From: tmoran @ 2006-03-23 17:57 UTC (permalink / raw)


>Apart from the other suggestions you have got, maybe you could use
>GtkAda to use all its drawing facilities in an off-screen buffer and
   Along the same lines, but using CLAW, text2dib.ad? in
home.comcast.net/~tommoran4/scout_source.zip
is a small package that uses Windows to draw text into an in-memory bmp,
which can then be written or converted to png or whatever.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
                   ` (3 preceding siblings ...)
  2006-03-23 17:33 ` Alex R. Mosteo
@ 2006-03-23 19:31 ` Gautier
  2006-03-25  3:12 ` Gene
  2006-04-10 22:19 ` Stefan Skoglund
  6 siblings, 0 replies; 15+ messages in thread
From: Gautier @ 2006-03-23 19:31 UTC (permalink / raw)


Anders Wirzenius:

> I want to produce a 2d graph to be presented as an image on a HTML page.
> Does anyone have an Ada example for, say, SVG?
> The data is a textfile with x and y values on each line.
> 1.0   1.0
> 2.3   3.2
> 3.0   5.9

Maybe you'll be interested by...

  http://www.mysunrise.ch/users/gdm/graph.htm

You have there two vectorial graphics formats (PostScript (incl. EPSF)
and DXF); then adding a SVG driver or using Ghostscript to obtain a
bitmap from EPSF should be doable.

_______________________________________________________________ 
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm 
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm 

NB: For a direct answer, e-mail address on the Web site!



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 14:04   ` Bobby D. Bryant
@ 2006-03-24  7:03     ` Anders Wirzenius
  2006-03-24  8:44       ` Jacob Sparre Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Anders Wirzenius @ 2006-03-24  7:03 UTC (permalink / raw)


bdbryant@mail.utexas.edu (Bobby D. Bryant) writes:

> 
> Does it need to be done in real time?  What role does Ada play, vs.
> using R or gnuplot?
> 

No, not necessarily real time, but it would be nice. :)
Ada is not a must, but would be nice. :)

I wanted to query what Ada support there is for 2d line graphics.

Thanks for the GnuPlot hint, seems easy to use. I can live with that
until I find an "Ada way".

-- 
Anders



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 17:33 ` Alex R. Mosteo
  2006-03-23 17:57   ` tmoran
@ 2006-03-24  7:21   ` Anders Wirzenius
  1 sibling, 0 replies; 15+ messages in thread
From: Anders Wirzenius @ 2006-03-24  7:21 UTC (permalink / raw)


"Alex R. Mosteo" <devnull@mailinator.com> writes:

> 
> I have some packages for simple BMP drawing in memory. You can either
> serve the resulting file via AWS or write it to disk. There are
> functions for line/circle drawing.
> 
> https://svn.mosteo.com/public/Adagio%20head/src/agpl/agpl-bmp.ads
> https://svn.mosteo.com/public/Adagio%20head/src/agpl/agpl-bmp-draw.ads
> 

Thanks, I downloaded them and the corresponding adb file. 
The project is private, plotting for example the daily consumption of
oil for heating my house. Don't expect fast progress.

Yes, my plan is to publish the plot using AWS.

-- 
Anders



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-24  7:03     ` Anders Wirzenius
@ 2006-03-24  8:44       ` Jacob Sparre Andersen
  2006-03-25 12:33         ` Bobby D. Bryant
  0 siblings, 1 reply; 15+ messages in thread
From: Jacob Sparre Andersen @ 2006-03-24  8:44 UTC (permalink / raw)


Anders Wirzenius wrote:

> I wanted to query what Ada support there is for 2d line graphics.

My dad is using a GtkAda based library for 2D line graphics (actually
for proper plotting of data), but I don't know if the rendering is
done on the Ada level or in the Gtk code.

> Thanks for the GnuPlot hint, seems easy to use. I can live with that
> until I find an "Ada way".

I usually use Gnuplot for plotting data in LaTeX, PNG and Postscript
format, but maybe it's time to sit down and write an Ada library, so
the task can be better integrated in my other code.

Greetings,

Jacob
-- 
A password should be like a toothbrush. Use it every day;
change it regularly; and DON'T share it with friends.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
                   ` (4 preceding siblings ...)
  2006-03-23 19:31 ` Gautier
@ 2006-03-25  3:12 ` Gene
  2006-04-10 22:19 ` Stefan Skoglund
  6 siblings, 0 replies; 15+ messages in thread
From: Gene @ 2006-03-25  3:12 UTC (permalink / raw)



Anders Wirzenius wrote:
> I want to produce a 2d graph to be presented as an image on a HTML page.
> Does anyone have an Ada example for, say, SVG?

I don't have an ada example, but you can do all the graph drawing with
standard javascript so that your ada code only needs to generates a
javascript call.

An example that uses tables and stretched bitmaps to draw histograms is
at

http://www.dean.usma.edu/feedback/report.htm

Click on any of the "histogram" links.  You're welcome to use the
javascript graphing routines you'll find in the listing of the left
hand frame.

If you need a line graph, you can use the same approach with the
javascript graphics library at

http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm

See the "function plotter" link for example.  I have used this
successfully on several small projects.  Again, your ada has little to
do.  Just set up calls to javascript routines.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-24  8:44       ` Jacob Sparre Andersen
@ 2006-03-25 12:33         ` Bobby D. Bryant
  0 siblings, 0 replies; 15+ messages in thread
From: Bobby D. Bryant @ 2006-03-25 12:33 UTC (permalink / raw)


On Fri, 24 Mar 2006, Jacob Sparre Andersen <sparre@nbi.dk> wrote:

> Anders Wirzenius wrote:
> 
>> I wanted to query what Ada support there is for 2d line graphics.
> 
> My dad is using a GtkAda based library for 2D line graphics (actually
> for proper plotting of data), but I don't know if the rendering is
> done on the Ada level or in the Gtk code.
> 
>> Thanks for the GnuPlot hint, seems easy to use. I can live with that
>> until I find an "Ada way".
> 
> I usually use Gnuplot for plotting data in LaTeX, PNG and Postscript
> format, but maybe it's time to sit down and write an Ada library, so
> the task can be better integrated in my other code.

GtkAda includes bindings for the GtkExtra plotting utilities that
someone wrote in C <http://gtkextra.sourceforge.net/>, originally for
the development of SciGraphica <http://scigraphica.sourceforge.net/>.
GtkExtra (including the GtkAda binding) supports both 2D and 3D plots,
plus canvases that let you drag stuff around on, and various other stuff,
and will let you spill your plot to a file as Postscript.

You can see an example of its use here (watch line wrap) -
<http://www.cs.utexas.edu/users/bdbryant/talk-origins/mutation-experiment/index.html>
The plots were displayed in a window and updated in real time as the
program ran.  A button dumped it to a Postscript file as it appeared
at the time the button was clicked.  (I converted the .eps to .png for
the web page.)

Many of the Gtk.Extra plotting procedures have a very large number of
parameters, so when I was using it I made wrappers for various types
of plots I commonly used.  It might be useful if someone wrote a
higher-level package of wrappers for stuff everyone commonly uses.


If that's overkill, GtkAda also binds the ordinary GTK+ line drawing
routines, and you can dump them to a file as PNG or JPEG.  An example
can be seen at -
<http://www.cs.utexas.edu/users/bdbryant/talk-origins/ga-on-tsp/index.html>
Notice that the images don't have anti-aliasing for the lines.  There may
be a way to do that now, but I'm not sure.

The Postscript generated by the GtkExtra plotters does have
anti-aliasing, and produces stuff suitable for inclusion into
LaTeX documents.

I have a vague memory of seeing an Ada package that lets you talk
directly to GNUplot, though I'm not sure.  You might google for it
if that strikes your fancy.

-- 
Bobby Bryant
Austin, Texas



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: 2d graph
  2006-03-23 11:34 2d graph Anders Wirzenius
                   ` (5 preceding siblings ...)
  2006-03-25  3:12 ` Gene
@ 2006-04-10 22:19 ` Stefan Skoglund
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Skoglund @ 2006-04-10 22:19 UTC (permalink / raw)



A binding for libsvg could do it, dito for libgnomeprint.

Neiter way, metapost or gnuplot is nicer.



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2006-04-10 22:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-23 11:34 2d graph Anders Wirzenius
2006-03-23 13:20 ` Dmitry A. Kazakov
2006-03-23 13:40   ` Anders Wirzenius
2006-03-23 14:04   ` Bobby D. Bryant
2006-03-24  7:03     ` Anders Wirzenius
2006-03-24  8:44       ` Jacob Sparre Andersen
2006-03-25 12:33         ` Bobby D. Bryant
2006-03-23 15:38 ` Jeffrey R. Carter
2006-03-23 17:23 ` Jacob Sparre Andersen
2006-03-23 17:33 ` Alex R. Mosteo
2006-03-23 17:57   ` tmoran
2006-03-24  7:21   ` Anders Wirzenius
2006-03-23 19:31 ` Gautier
2006-03-25  3:12 ` Gene
2006-04-10 22:19 ` Stefan Skoglund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox