Re: [GENERAL] Creating web images from postgres data

From: Oleg Broytmann <phd(at)sun(dot)med(dot)ru>
To: Lincoln Spiteri <lincoln(dot)spiteri(at)st(dot)com>
Cc: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] Creating web images from postgres data
Date: 1998-10-28 12:46:51
Message-ID: Pine.SOL2.3.96.SK.981028153413.21439C-100000@sun.med.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

On Wed, 28 Oct 1998, Lincoln Spiteri wrote:
> I am currently starting up a pilot project to demonstrate the power of
> the linux/postgres/php trio in an enterprise setting.
>
> I would like to be able to output graphs from data stored in a postgres
> table for viewing on a web browser as a means of data presentation.
> Could anyone give me some suggestions as to what the best approach would
> be to achieve this.

As you already have (or will have in the near future) php, I want to
stress there is php<->gd interface (gd is GIF drawing library). You should
write plotting program by youself.

Another solution is to use gnuplot program. The gnuplot solution is much
simpler, but there are drawbacks - often gnuplot is TOO simple.

Example.
This is datafile (data you drawn from database):
21 12 12
22 12 10
23 12 12
24 14 16
25 14 17
26 15 18
27 16 18.5
28 17 21
29 20 25
30 18 24

This datafile means: data for 21, 22, ..., 30 June are:
21 June: min = 12, max = 12... and so on.
This is command file you feed into gnuplot's stdin:
set term pbm color
plot "demo-gif.dat" using "%f%f" title "Min" with linespoints, \
"demo-gif.dat" using "%f%*f%f" title "Max" with linespoints

After this, gnuplot will generate ppm file on stdout. Filter it through
ppmchange (to correct colors) and ppmtogif to produce GIF. To make results
a bit nicer, make the GIF transparent (ppmtogif -transparent) and put the
GIF onto nice HTML background.
Latest version of gnuplot can be linked with gd library and can produce
GIF files without intermediate ppm.

Example in the real world: http://rinaco.ice.ru/analytics/q_c/
Generated with gnuplot.

Oleg.
----
Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/
Programmers don't die, they just GOSUB without RETURN.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dustin Sallings 1998-10-28 17:20:27 Re: [GENERAL] 8k limit
Previous Message Herouth Maoz 1998-10-28 12:30:08 Re: [GENERAL] Getting input from email...