2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

ls/lw patch from Arno

git-svn-id: https://svn.fhem.de/fhem/trunk@996 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2011-09-07 08:06:48 +00:00
parent 5ac9a7b3af
commit 2a2ca9a53c
2 changed files with 14 additions and 6 deletions

View File

@ -110,11 +110,13 @@ SVG_render($$$$$$$)
} }
# Digest axes/title/type from $plot (gnuplot) and draw the line-titles # Digest axes/title/type from $plot (gnuplot) and draw the line-titles
my (@axes,@ltitle,@type); my (@axes,@ltitle,@type,@linestyle,@linewidth);
my $i; my $i;
$i = 0; $plot =~ s/ axes (\w+)/$axes[$i++]=$1/gse; $i = 0; $plot =~ s/ axes (\w+)/$axes[$i++]=$1/gse;
$i = 0; $plot =~ s/ title '([^']*)'/$ltitle[$i++]=$1/gse; $i = 0; $plot =~ s/ title '([^']*)'/$ltitle[$i++]=$1/gse;
$i = 0; $plot =~ s/ with (\w+)/$type[$i++]=$1/gse; $i = 0; $plot =~ s/ with (\w+)/$type[$i++]=$1/gse;
$i = 0; $plot =~ s/ ls (\d+)/$linestyle[$i++]=$1/gse;
$i = 0; $plot =~ s/ lw (\d+)/$linewidth[$i++]=$1/gse;
for my $i (0..int(@type)-1) { # axes is optional for my $i (0..int(@type)-1) { # axes is optional
$axes[$i] = "x1y2" if(!$axes[$i]); $axes[$i] = "x1y2" if(!$axes[$i]);
@ -133,7 +135,7 @@ SVG_render($$$$$$$)
} }
pO "<text title=\"$desc\" ". pO "<text title=\"$desc\" ".
"onclick=\"parent.svg_labelselect(evt)\" line_id=\"line_$i\" " . "onclick=\"parent.svg_labelselect(evt)\" line_id=\"line_$i\" " .
"x=\"$off1\" y=\"$off2\" text-anchor=\"end\" class=\"l$i\">$t</text>"; "x=\"$off1\" y=\"$off2\" text-anchor=\"end\" class=\"l" . ($linestyle[$i]//$i) . "\">$t</text>";
$off2 += $th; $off2 += $th;
} }
@ -414,7 +416,7 @@ SVG_render($$$$$$$)
$ret .= sprintf(" %d,%d", $x1, $y1); $ret .= sprintf(" %d,%d", $x1, $y1);
} }
pO "<polyline $js_helpers points=\"$ret\" class=\"l$idx\"/>"; pO "<polyline $js_helpers points=\"$ret\" style=\"stroke-width:" . ($linewidth[$idx]//1) . "\" class=\"l" . ($linestyle[$idx]//$idx) . "\"/>";
} }

View File

@ -10,7 +10,7 @@
# if plotsize is less than 800,400 # if plotsize is less than 800,400
#set terminal png transparent small size <SIZE> crop #set terminal png transparent small size <SIZE> crop
set terminal png transparent size <SIZE> crop set terminal png transparent truecolor rounded medium size <SIZE> enhanced
set output '<OUT>.png' set output '<OUT>.png'
set xdata time set xdata time
@ -26,10 +26,16 @@ set y2label "Temperature in C"
set ylabel "Humidity (%)" set ylabel "Humidity (%)"
#FileLog 4:T\x3a:0: #FileLog 4:T\x3a:0:
#FileLog 4:T\x3a:0:
#FileLog 6:H\x3a:0:
#FileLog 6:H\x3a:0: #FileLog 6:H\x3a:0:
plot \ plot \
"< awk '/T:/ {print $1, $4}' <IN>"\ "< awk '/T:/ {print $1, $4}' <IN>"\
using 1:2 axes x1y2 title 'Measured temperature' with lines lw 2,\ using 1:2 axes x1y2 title '' with lines ls 7 lw 4,\
"< awk '/T:/ {print $1, $4}' <IN>"\
using 1:2 axes x1y2 title 'Measured temperature' with lines ls 0 lw 1,\
"< awk '/H:/ {print $1, $6}' <IN>"\ "< awk '/H:/ {print $1, $6}' <IN>"\
using 1:2 axes x1y1 title 'Humidity (%)' with lines lw 1\ using 1:2 axes x1y1 title '' with lines ls 7 lw 4;\
"< awk '/H:/ {print $1, $6}' <IN>"\
using 1:2 axes x1y1 title 'Humidity (%)' with lines ls 2 lw 1;\