[Module] Graph Editor

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Post Reply
Minus
Starting Member
Starting Member
Posts: 12
Joined: Tue Feb 10, 2009 11:33 am
Location: France

[Module] Graph Editor

Post by Minus »

Hi,

I start to write a "Graph Editor"
The goal of this peace of code is to make the more flexible as possible rrdgraph printing.
  • Change color (graph, background, shade...)
    Multi graph
A first screenshot to give a first preview:
GraphEditor.png
GraphEditor.png (22.24 KiB) Viewed 9042 times
Example of rrdgraph print:
frigo-temp-1d.png
frigo-temp-1d.png (10.16 KiB) Viewed 9042 times
More spec will be arrive soon.
I hope not to be in the same scope as one of your current dev :roll:
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

Very nice and good idea.
Never got around making multi-graphing work.

The development version is changing/growing fast, but in other areas, so keep on working on it, and if you're ready I will integrate it.

Thanks!
Regards, Ron.
hhg
Starting Member
Starting Member
Posts: 20
Joined: Sun Jul 18, 2010 6:45 pm
Location: Denmark

Re: [Module] Graph Editor

Post by hhg »

Hi Ron/Minus

Is this module/code available some where? It looks nice!

Best regards
hhg
Minus
Starting Member
Starting Member
Posts: 12
Joined: Tue Feb 10, 2009 11:33 am
Location: France

Re: [Module] Graph Editor

Post by Minus »

I 've added loads of fuctions and redesign the code.

This first version (0.0001) is working but some functions have to be redesign.

I'm actually working on this (during my free time :roll: )
Graph_Editor.jpg
Graph_Editor.jpg (84.07 KiB) Viewed 8993 times
Attachments
DomotiGa_GraphEditor_v0.0001.zip
(73.71 KiB) Downloaded 363 times
j.hoekstra
Member
Member
Posts: 255
Joined: Thu Jun 25, 2009 2:09 pm
Location: Enschede, The Netherlands

Re: [Module] Graph Editor

Post by j.hoekstra »

Very nice :)
Look forward to seeing it added in the main repo :)
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

Thanks.

Funny to see that all of a sudden users start mailing their code contributions to DomotiGa at the same time within 2-3 days... :wink:
I'll see what I can do...
Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

Minus wrote: I 've added loads of functions and redesign the code.
This first version (0.0001) is working but some functions have to be redesign.
Hi Minus, I have added your work to version 0.1.187.

Cleaned up code.
Fixed spelling errors widht -> width (db table name)
Store original device name in Combo, make lowercase DSname in other routine (otherwise devices with capitals are not found)
Sort combolist entries for easier searching.
Add period selection to preview window.
Todo: Move graph generate code to a module so DomotiGaServer can generate graphs too. (for example if a xmlrpc call requests that)
Bug left: ERROR: Cannot parse vname from 'DEF:www.google.com_rtt=/home/ron/domotiga/rrd/www.google.com.rrd:rtt:AVERAGE'
I also moved some fields and buttons around in the GUI, hope you don't mind.
Thanks again for your work!
Regards, Ron.
Minus
Starting Member
Starting Member
Posts: 12
Joined: Tue Feb 10, 2009 11:33 am
Location: France

Re: [Module] Graph Editor

Post by Minus »

RDNZL wrote:
Minus wrote: I 've added loads of functions and redesign the code.
This first version (0.0001) is working but some functions have to be redesign.
Hi Minus, I have added your work to version 0.1.187.

Cleaned up code.
Fixed spelling errors widht -> width (db table name)
Store original device name in Combo, make lowercase DSname in other routine (otherwise devices with capitals are not found)
Sort combolist entries for easier searching.
Add period selection to preview window.
Todo: Move graph generate code to a module so DomotiGaServer can generate graphs too. (for example if a xmlrpc call requests that)
Bug left: ERROR: Cannot parse vname from 'DEF:www.google.com_rtt=/home/ron/domotiga/rrd/www.google.com.rrd:rtt:AVERAGE'
I also moved some fields and buttons around in the GUI, hope you don't mind.
Thanks again for your work!
So quick, thanks you so much !
Every change seems to be perfect,
your Todo list is my final goal :wink:
About the bug, could you post the rrdgraph command generated when it appear ? (you can find it in Debug window)

Thanks again for your work :)
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

Error:

Code: Select all

ERROR: Cannot parse vname from 'DEF:www.google.com_rtt=/home/ron/domotiga/rrd/www.google.com.rrd:rtt:AVERAGE'
Command:

Code: Select all

2010/09/17 22:21:28 [Graph Editor] rrdtool graph /tmp/gambas.1000/23626/15.tmp --lazy --start end-1d -a PNG --slope-mode --font DEFAULT:7: --watermark 'Domotiga v0.1.187' --width 400 --height 100 -c BACK#FFFFFF -c CANVAS#FFFFFF -c SHADEA#000000 -c SHADEB#000000 -c GRID#000000 -c MGRID#000000 -c FONT#000000 -c AXIS#000000 -c FRAME#000000 -c ARROW#000000 --title='Google Bug' --vertical-label '' DEF:www.google.com_rtt=/home/ron/domotiga/rrd/www.google.com.rrd:rtt:AVERAGE COMMENT:'\s' COMMENT:'                      ' COMMENT:'\l' LINE1:www.google.com_rtt#00FF00:'RTT                 ' COMMENT:'\s' COMMENT:'\s'  2>&1 >/dev/null
Others work ok, maybe because of the dots in the device name, quotes missing, dunno...?
Regards, Ron.
Minus
Starting Member
Starting Member
Posts: 12
Joined: Tue Feb 10, 2009 11:33 am
Location: France

Re: [Module] Graph Editor

Post by Minus »

RDNZL wrote:Others work ok, maybe because of the dots in the device name, quotes missing, dunno...?
I found the reason, VDEF name (made from device name) can't be with a dot inside.

Source :
http://oss.oetiker.ch/rrdtool/forum.en. ... -td4617331
the reason for limiting the characterset of vnames is to
simplify parsing CDEF expressions (no , for example) and for future
enhancements. At the moment, allowing the . would not hurt, but it
would prevent us from using it for something more useful in the
future or we would have to come up with more backslash escapes
which do not help either ...
The solution could be to add in DeviceName2RRDName a regex to replace dot to whatever :

Code: Select all

sRRDName = Replace$(sRRDName, ".", "{whatever}")
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

I have fixed it in latest revision, it works ok now.
RRD databases will be saved without dots in their name, rename them manually if you have any, otherwise new/empty ones will be created next to it.
Regards, Ron.
hhg
Starting Member
Starting Member
Posts: 20
Joined: Sun Jul 18, 2010 6:45 pm
Location: Denmark

Re: [Module] Graph Editor

Post by hhg »

Hi Minus/Ron

Very nice indeed. Is the Graphs displayed some other places rigth now, besides the preview vindow? Or is some one working on that code?

I ran into the same VDEF error, not because of punctuation, but because I had some Danish national letters in my sensor names (Room is "værelse" in danish).
So I will take a look at DeviceName2RRDName too see if I can restrict it to A-Z, mayby adding
sRRDName = Conv$(sRRDName, System.Charset, "ASCII")
Need to experiment here - Not that familar with Gambas.

Regards
hhg
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: [Module] Graph Editor

Post by RDNZL »

Because the new graphs are defined in the database now we can simply add a categories field and let the pages like climate energy etc display the graphs having the same category name.
Should we disable the old simple graphs display there?
Regards, Ron.
hhg
Starting Member
Starting Member
Posts: 20
Joined: Sun Jul 18, 2010 6:45 pm
Location: Denmark

Re: [Module] Graph Editor

Post by hhg »

Yes, a categories field in the Graph Editor is the way to go. I don't think we should disable the simple graphs entirely, but perhaps and option under the Device Graph tab to enable/disable "Simple Graphs" - Default should be enabled, so "the out-of-the-box" experience is "Enable Graphing" and get a simple Graph!
If you only have a few sensors, that can do it - If more, use the Graph Editor.
Post Reply

Return to “DomotiGa Forum”