HowTo create a new graph ?

253 views
Skip to first unread message

anthropo

unread,
Apr 25, 2012, 6:52:41 AM4/25/12
to wv...@googlegroups.com
hello, i'm desperating looking for a way to generate a new graph. Can
one explane me where to do this ?

thank you

Luis Rosety

unread,
Apr 27, 2012, 2:50:34 PM4/27/12
to wv...@googlegroups.com
There are many ways.
Apart from the method used by wview, I have been playing with other different methods.
1. Generating them with PHP + gdlib
2. Creating a SVG template and moving their components according to the readings
in this page http://www.veleta.info/index.php?opt=2&sopt=2 you can see 3 dials that have been created with SVG and then converted to PNG using the post-generation script
The pointers are rotated depending on the readings.
The graph is made reading the NOAA text files of the selected months and years and the chosen variable is plotted for comparison.
This one is created with PHP+gdlib

Luis

On 25 April 2012 12:52, anthropo <anth...@free.fr> wrote:
hello, i'm desperating looking for a way to generate a new graph. Can one explane me where to do this ?

thank you


--
You received this message because you are subscribed to the Google Groups "wview" group.
To post to this group, send email to wv...@googlegroups.com.
To unsubscribe from this group, send email to wview+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wview?hl=en.


Graham Eddy

unread,
Apr 27, 2012, 11:01:00 PM4/27/12
to wv...@googlegroups.com
the "wview way" is to add code to wview, it is designed to be extendable.
it means you must build wview from source code, not just install the binaries.
basically, you go into /usr/local/src/wview*/htmlgenerator/images-user.c, copy/paste a similar function and modify it, add the function to the dispatch table at the end, rebuild, then update /usr/local/etc/wview/images-user.conf to tell wview to call the new function

you might need to copy the code from images.c, or - as in my case - update images.c in situ
___________
Graham Eddy

To unsubscribe from this group, send email to wview+un...@googlegroups.com.

bassemolufda

unread,
Apr 28, 2012, 4:19:07 PM4/28/12
to wview
Hey all...

this is a nice graphics at http://www.veleta.info/index.php?opt=2&sopt=2

I WANT THIS ALSO... but how must i do to use this???

please help.

Luis Rosety

unread,
Apr 28, 2012, 9:15:00 PM4/28/12
to wv...@googlegroups.com
As Graham said, the "wview" way involves modifying the source code to add the new images.
Since I didn't want to touch the original wview code (I don't know what woud've happened with the automatic wview updates) I decided to look for alternative ways of generating graphs without modifying wview.
As a result, these are not standard wview graphs or images.
In the meantime I have seen other interesting ways of producing customized graphs using javascript libraries.


Luis



--
You received this message because you are subscribed to the Google Groups "wview" group.
To post to this group, send email to wv...@googlegroups.com.
To unsubscribe from this group, send email to wview+un...@googlegroups.com.

anthropo

unread,
Apr 29, 2012, 8:12:39 AM4/29/12
to wv...@googlegroups.com, lu...@rosety.com
Thank you Luis,

But... Can you explain more, give examples or scripts...

i'm actually looking for the way to save data in a mysql database as after i know how (php, java...) to proceed. 

http://f5rm.dyndns.org/ws2300/  and http://f5rm.dyndns.org:8080/ws2300/ListerStatistiques?mode=Mois+Annees&graphe_par_ligne=3  are examples of what is explained here, but this site is old : http://anthropo.free.fr/ws2300/Documentation/index.html


Thank you

Dan

unread,
Apr 29, 2012, 12:40:59 PM4/29/12
to wv...@googlegroups.com, lu...@rosety.com
One way to to this is with gnuplot.  Since I couldn't find a way to get the past 24 hours out of SQLite, I did the export to a MySql DB using the manual directions http://www.wviewweather.com/release-notes/wview-User-Manual.html#Advanced-db on a cron job every 5 mins or so, then used this script:

#!/bin/sh
mysql --user=root --password=wview wviewDB < /opt/mysql.sql > output.tab
gnuplot -persist <<PLOT
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set term png size 1000, 600
set output "/var/lib/wview/img/presswind.png"
set ytics nomirror
set y2range [ -5 : 375 ]
set y2tics ("North" 0, "East" 90, "South" 180, "West" 270, "North" 360)
set xlabel "Time (24hour)"
set ylabel "Pressure"
set y2label "Wind Direction"
set style histogram columnstacked
plot "./output.tab" u 1:3 t 'pressure' w lines axis x1y1, \
"./output.tab" u 1:4 t 'wind direction' w linespoints axis x1y2
quit
exit

And that creates this: http://danchase.net/egweather/presswind.png
I don't like it since it only shows 5 minute intervals, but it's a start!

-Dan

anthropo

unread,
Apr 27, 2012, 3:14:51 PM4/27/12
to wv...@googlegroups.com
thank you, and that's great.

can i ask more ? for example scripts that had generated those graphs ?

That'd be a  base for my development

thanks again






Le 27/04/2012 20:50, Luis Rosety a écrit :
There are many ways.
Apart from the method used by wview, I have been playing with other different methods.
1. Generating them with PHP + gdlib
2. Creating a SVG template and moving their components according to the readings
in this page http://www.veleta.info/index.php?opt=2&sopt=2 you can see 3 dials that have been created with SVG and then converted to PNG using the post-generation script
The pointers are rotated depending on the readings.
The graph is made reading the NOAA text files of the selected months and years and the chosen variable is plotted for comparison.
This one is created with PHP+gdlib

Luis

On 25 April 2012 12:52, anthropo <anth...@free.fr> wrote:
hello, i'm desperating looking for a way to generate a new graph. Can one explane me where to do this ?

thank you


--
You received this message because you are subscribed to the Google Groups "wview" group.
To post to this group, send email to wv...@googlegroups.com.
To unsubscribe from this group, send email to wview+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wview?hl=en.

--
You received this message because you are subscribed to the Google Groups "wview" group.
To post to this group, send email to wv...@googlegroups.com.
To unsubscribe from this group, send email to wview+un...@googlegroups.com.

anthropo

unread,
Apr 29, 2012, 4:38:03 AM4/29/12
to wv...@googlegroups.com
Thank you Luis,

But... Can you explain more, give examples or scripts...

i'm actually looking for the way to save data in a mysql database as after i know how (php, java...) to proceed. 

http://f5rm.dyndns.org/ws2300/  and http://f5rm.dyndns.org:8080/ws2300/ListerStatistiques?mode=Mois+Annees&graphe_par_ligne=3  are examples of what is explained here, but this site is old : http://anthropo.free.fr/ws2300/Documentation/index.html


Thank you




Luis Rosety

unread,
Apr 30, 2012, 4:00:51 AM4/30/12
to wv...@googlegroups.com
The scripts are a bit crappy since I just wanted to try different ways to create new graphs.
Let me clean them a bit and I will send them to you.

Luis Rosety

unread,
May 8, 2012, 5:20:07 PM5/8/12
to wv...@googlegroups.com
Sorry for the late answer but I have been quite busy these days.
I have put all files that I use for the gauges that you have been asking for into the attached compressed directory
As I said before, the gauges are based on SVG images.
I wanted to use them directly as SVG on my site but not all the browsers support SVG and those that do, they produce different results.
Therefore, I decided to convert them on the fly into png.
Now the stuff:
1.Copy the file parameterlist.phpx to the same place where you have the templates (normally /etc/wview/html)
2.Edit your html-templates.conf adding a the template parameterlist.phpx. This will produce a file parameterlist.php into your wview site directory
3.copy the scripts dial-script.php, compass-script.php and svg2png.php to your website directory
4.Copy the background png image drawing.png  into the same directory as the scripts. I have included the SVG image that I created for the background. I made it with Inkscape and then I exported it to png. You can modify the provided svg and create your version of the background.
5.Edit the file /etc/wview/post-generate.sh and add the line
php /var/www/weather/svg2png.php 
(modify the path if necessary)
6. Install Inkscape. This is needed for the conversion from SVG to PNG

I am convinced that the whole stuff can be greatly improved but I started with the idea of creating new images regardless of the wview distribution so it can be updated wih no interference.
The SVG images have the advantage of being flexible and capable of rich "cosmetic" finishing

Please let me know if it works for you


On 27 April 2012 21:14, anthropo <anth...@free.fr> wrote:
svg-gauges.tar.gz
Reply all
Reply to author
Forward
0 new messages