mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
plotfunction ptches by Tobias
git-svn-id: https://svn.fhem.de/fhem/trunk@2136 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b555cdda20
commit
02296ff6d8
@ -1320,17 +1320,31 @@ FW_readgplotfile($$$)
|
||||
open(FH, $gplot_pgm) || return (FW_fatal("$gplot_pgm: $!"), undef);
|
||||
while(my $l = <FH>) {
|
||||
$l =~ s/\r//g;
|
||||
my $plotfn = undef;
|
||||
if($l =~ m/^#FileLog (.*)$/ &&
|
||||
($wltype eq "fileplot" || $wl eq "FileLog")) {
|
||||
push(@filelog, $1);
|
||||
$plotfn = $1;
|
||||
} elsif ($l =~ m/^#DbLog (.*)$/ &&
|
||||
($wltype eq "dbplot" || $wl eq "DbLog")) {
|
||||
push(@filelog, $1);
|
||||
$plotfn = $1;
|
||||
} elsif($l =~ "^plot" || $plot) {
|
||||
$plot .= $l;
|
||||
} else {
|
||||
push(@data, $l);
|
||||
}
|
||||
|
||||
if($plotfn) {
|
||||
my $specval = AttrVal($wl, "plotfunction", undef);
|
||||
if ($specval) {
|
||||
my @spec = split(" ",$specval);
|
||||
my $spec_count=1;
|
||||
foreach (@spec) {
|
||||
$plotfn =~ s/<SPEC$spec_count>/$_/g;
|
||||
$spec_count++;
|
||||
}
|
||||
}
|
||||
push(@filelog, $plotfn);
|
||||
}
|
||||
}
|
||||
close(FH);
|
||||
|
||||
|
@ -12,7 +12,7 @@ weblink_Initialize($)
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "weblink_Define";
|
||||
$hash->{AttrList}= "fixedrange plotmode plotsize label title htmlattr";
|
||||
$hash->{AttrList}= "fixedrange plotmode plotsize label title htmlattr plotfunction";
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ weblink_Define($$)
|
||||
<a name="weblinkdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> weblink [link|fileplot|image|iframe|htmlCode]
|
||||
<code>define <name> weblink [link|fileplot|dbplot|image|iframe|htmlCode]
|
||||
<argument></code>
|
||||
<br><br>
|
||||
This is a placeholder used with webpgm2 to be able to integrate links
|
||||
@ -60,6 +60,7 @@ weblink_Define($$)
|
||||
<code>define hr weblink htmlCode <hr></code><br>
|
||||
<code>define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") }</code><br>
|
||||
<code>define MyPlot weblink fileplot <logdevice>:<gnuplot-file>:<logfile></code><br>
|
||||
<code>define MyPlot weblink dbplot <logdevice>:<gnuplot-file></code><br>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
@ -133,7 +134,28 @@ weblink_Define($$)
|
||||
<li>title<br>
|
||||
A special form of label (see above), which replaces the string <TL>
|
||||
in the .gplot file. It defaults to the filename of the logfile.
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<a name="plotfunction"></a>
|
||||
<li>plotfunction<br>
|
||||
Space value separated list of values. The value will be used to replace
|
||||
<SPEC#> type of strings in the .gplot file, with # beginning at 1
|
||||
(<SPEC1>, <SPEC2>, etc.) in the #FileLog or #DbLog directive.
|
||||
With this attribute you can use the same .gplot file for multiple devices
|
||||
with the same logdevice.
|
||||
<ul><b>Example:</b><br>
|
||||
<li>#FileLog <SPEC1><br>
|
||||
with: attr <weblinkdevice> plotfunction "4:IR\x3a:0:"<br>
|
||||
instead of<br>
|
||||
#FileLog 4:IR\x3a:0:
|
||||
</li>
|
||||
<li>#DbLog <SPEC1><br>
|
||||
with: attr <weblinkdevice> plotfunction "Garage_Raumtemp:temperature::"<br>
|
||||
instead of<br>
|
||||
#DbLog Garage_Raumtemp:temperature::
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<br>
|
||||
|
Loading…
Reference in New Issue
Block a user