[gelöst] with "bars" - Balkenbreite festlegen

Begonnen von Andi291, 12 Dezember 2017, 08:39:59

Vorheriges Thema - Nächstes Thema

Andi291

Hallo zusammen!

Ich möchte zur Visualisierung meines Stromverbrauches (unterteilt in Allgemein, HLK und Garage) monatlich parallele Säulen in einem gemeinsamen Diagramm haben.
Mit Offset bekomme ich das auch wunderbar hin.

Mein Problem ist die Breite der Säulen - in der Jahresansicht sind diese exakt 1 Monat breit. Und ums verrecken nicht schmaler zu bekommen.
Im "normalem" Gnu-plot genügt ein

set bars 0.2

Leider wird dies in der gplot-Datei von FHEM ignoriert.

Hat jemand einen Tip für mich, wie ich die Balken schmaler als 1 Monat bekomme?

Danke!

# Created by FHEM/98_SVG.pm, 2017-12-11 22:14:08
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics
set grid ytics
set ylabel "Humidity"
set yrange "[0:120]"

#lp DbLog:logger,offset="-691200",extend="691200":zaehler_kosten_allgemein_mai:state:0:int
#lp DbLog:logger,offset="-1382400",extend="691200":zaehler_kosten_hlk_mai:state:0:int
#lp DbLog:logger,offset="-2073600",extend="691200":zaehler_kosten_garage_mai:state:0:int
#lp DbLog:logger,offset="-691200",extend="691200":zaehler_kosten_allgemein_juni:state:0:int
#lp DbLog:logger,offset="-1382400",extend="691200":zaehler_kosten_hlk_juni:state:0:int
#lp DbLog:logger,offset="-2073600",extend="691200":zaehler_kosten_garage_juni:state:0:int

plot "<IN>" using 1:2 axes x1y1 title 'Line 1' ls l3fill lw 4 with bars,\
     "<IN>" using 1:2 axes x1y1 title 'Line 2' ls l6fill lw 4 with bars,\
     "<IN>" using 1:2 axes x1y1 title 'Line 3' ls l4fill lw 4 with bars,\
     "<IN>" using 1:2 axes x1y1 title 'Line 1' ls l3fill lw 4 with bars,\
     "<IN>" using 1:2 axes x1y1 title 'Line 2' ls l6fill lw 4 with bars,\
     "<IN>" using 1:2 axes x1y1 title 'Line 3' ls l4fill lw 4 with bars

erwin

Hi Andi,

ich hab das mit logproxy hinbekommen..
in der 99_myutils.pm:
## create a bar where SVG just provides a single point
## used in MH_Stromzaehler_jear.gplot
## use histeps for display
## called from SVG
##
sub MH_makeline($$) {
   my($devspec,$array) = @_;
   my @array1;

   foreach my $point ( @{$array} ) {
      my $newtime = $point->[0] + 600; # 10 Minutes width
#      Log 1, "in MH_makeline Secs=$point->[0] Val=$point->[1] newtime=$newtime";
      push (@array1, [$point->[0],0],[$point->[0],$point->[1]],[$newtime,0]);
   }
   return \@array1;
}


die gplot datei:
# Created by FHEM/98_SVG.pm, 2015-05-08 13:02:20
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics
set y2tics
set grid y2tics
set ylabel "maximal Werte (kW)"
set y2label "Monats Werte (kWh)"
set yrange {sprintf("[0:%d]",MH_max($data{max4},$data{max5}) * 1.1 + 1)}
#set yrange [0:]
set y2range {sprintf("[0:%d]",MH_max($data{max1},$data{max2},$data{max3}) * 1.1 + 1)}

#logProxy DbLog:myDbLog,extend='1m',offset='-1m',predict=2592000:Stromzaehler:Bezug-lastMonth:
#logProxy DbLog:myDbLog,extend='1m',offset='-1m',predict=2592000:Stromzaehler:Einspeisung-lastMonth:
#logProxy DbLog:myDbLog,offset=-2592000,predict=2592000:myKostal:Monthly.Energy:::
#logProxy DbLog:myDbLog,clip,postFn='MH_makeline':Stromzaehler:maxPwr-Bezug-Mon::
#logProxy DbLog:myDbLog,clip,postFn='MH_makeline':Stromzaehler:maxPwr-Einspeisung-Mon::

plot "<IN>" using 1:2 axes x1y2 title 'Bezug' ls l0 lw 1.5 with steps,\
     "<IN>" using 1:2 axes x1y2 title 'Einspeisung' ls l1 lw 1.5 with steps,\
     "<IN>" using 1:2 axes x1y2 title 'Produktion' ls l2 lw 1 with steps,\
     "<IN>" using 1:2 axes x1y1 title 'max.Bezug' ls l4 lw 3 with histeps,\
     "<IN>" using 1:2 axes x1y1 title 'max.Einspeisung' ls l3 lw 3 with histeps


die für dich interessanten Zeilen sind die max.Bezug, bzw. max.Einspeisung.
wichtig ist evtl noch: attr fixedrange year

Ich bin übrigens am umsteigen auf Grafana, bisher bin ich begeistert: Funktion und Geschwindigkeit, einfach super! Einzig mit der Integration in die FHEM webseite kämpf ich noch.

l.g. erwin
FHEM aktuell auf RaspberryPI Mdl 1-4
Maintainer: 00_KNXIO.pm 10_KNX.pm
User: CUNO2 (868 SLOWRF) - HMS100xx, FS20, FHT, 1-Wire  - 2401(iButton), 18x20, 2406, 2413 (AVR), 2450,..,MQTT2, KNX, SONOFF, mySENSORS,....
Hardware:  Busware ROT, Weinzierl IP731, 1-Wire GW,...

Andi291

Danke, das war der richtige Impuls.

Und damit schaffe ich es sogar ohne myUtils:

#lp DbLog:logger,offset="-691200",predict="691200":zaehler_kosten_allgemein_mai:state:0:int
#lp DbLog:logger,offset="-1382400",predict="691200":zaehler_kosten_hlk_mai:state:0:int
#lp DbLog:logger,offset="-2073600",predict="691200":zaehler_kosten_garage_mai:state:0:int


Merci und Grüße, Andi