eCharts in FHEM (Version 0.0.12.4)

Begonnen von andies, 06 Februar 2024, 22:06:15

Vorheriges Thema - Nächstes Thema

FhemPiUser

sieht gut aus. Kann man den Bereich unter den Kurven auch füllen, wir auf den Apache Beispielen gezeigt?

Und gehen auch Stacked bars?

andies

Wie gesagt, ich habe da keinen vernünftigen use-case und kann das nicht richtig testen. Aber wenn du in der gplot-Datei die richtige Art der Darstellung ausgibt (eben nicht line, sondern bars oder was immer man da macht) und dann das Attribut stacked setzt, klappt es bei mir. Obwohl ja das manual sagt, es gehe nicht...
FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

andies

FHEM 6.3 auf RaspPi4 (Raspbian:  6.6.28+; Perl: v5.36.0)
SIGNALduino (433 MHz) und HM-UART (868 MHz), Sonoff, Blitzwolf, Somfy RTS, CAME-Gartentor, Volkszähler, Keyence-Sensor, Homematic-Sensoren und -thermostat, Ferraris-Zähler für Wasseruhr, Openlink-Nachbau Viessmann

schwatter

Tag,

ich habe an der Legendcolor gebastelt. Ich hatte immer das Problem, wenn ich ein Element in Legend aktiviert habe,
das es dunkler, bzw grau wurde.

Zum anpassen habe ich Ziele 618 geändert:
${$eCharts_options_ref}{legend} = { data => \@legend, left => AttrVal($name, "position_legend", "10"), (AttrVal($name, "legendColor", "") ? (textStyle => { color => AttrVal($name, "legendColor", "transparent") }) : ()) };
Und für das attr Zeile 1123:
          legendColor
Wird die Farbe mit Klarnamen (white,blue,...) gesetzt, wird diese korrekt geändert.
Wird anstelle von Klarnamen eine beliebige Zahl, von mindestens 2 Stellen (00) angegeben, dann nehmen die Legendnamen
die Farbe von den zugewiesenen Plotstyle an.

Gruß schwatter

schwatter

Und hier noch für Labelcolor:

    ######################
    # Options -> x-Achse
    ######################
    my @xAxis = ();
push(@xAxis, {});
$xAxis[0]->{type} = 'time';
    my $t = ($conf{xlabel} ? $conf{xlabel} : "");
    $t =~ s/"//g;
    $xAxis[0]->{name} = $t if ($t);
    $xAxis[0]->{axisTick} = {alignWithLabel => JSON::true, show => JSON::true, inside => JSON::true, length => 10} if ($conf{xtics});
    $xAxis[0]->{axisLabel} = {textStyle => {color => AttrVal($name, "axisLabelColor", "#ffffff")}}; # Schriftfarbe hinzufügen
if ($doSplit) { # zweite x-Achse, wenn split-Attribut gesetzt
push(@xAxis, {});
$xAxis[1]->{type} = 'time';
    $t = ($conf{x2label} ? $conf{x2label} : "");
    $t =~ s/"//g;
    $xAxis[1]->{name} = $t if ($t); # TODO Color of x-Axis
    $xAxis[1]->{axisTick} = {alignWithLabel => JSON::true, show => JSON::true, inside => JSON::true, length => 10} if ($conf{xtics});
    $xAxis[1]->{axisLine} = {onZero => JSON::false, alignWithLabel => JSON::true, show => JSON::true, inside => JSON::true, length => 10} if ($conf{xtics});
        $xAxis[1]->{axisLabel} = {textStyle => {color => AttrVal($name, "axisLabelColor", "#ffffff")}}; # Schriftfarbe hinzufügen
}
${$eCharts_options_ref}{xAxis} = \@xAxis;
 
    ######################
    # Options -> y-Achse
    ######################
    #  my ($nr_left_axis,$nr_right_axis,$use_left_axis,$use_right_axis) = split(",", &SVG_Attr($parent_name, $name,"nrAxis","1,1")); # notwendig?
    my @yAxis = (); # array of y-axis
    # y-Achse ######################
    eCharts_CollectyAxisOptions(\@yAxis, $conf{ylabel}, $conf{ytics}, $conf{yrange}, AttrVal($name, "yrange", ""));
    # Schriftfarbe hinzufügen
    foreach my $yAxisOption (@yAxis) {
        $yAxisOption->{axisLabel}{textStyle}{color} = AttrVal($name, "axisLabelColor", "#ffffff");
    }
    # y2-Achse ######################
    eCharts_CollectyAxisOptions(\@yAxis, $conf{y2label}, $conf{y2tics}, $conf{y2range}, AttrVal($name, "y2range", "")) if ($conf{y2label});
    # Schriftfarbe hinzufügen
    foreach my $yAxisOption (@yAxis) {
        $yAxisOption->{axisLabel}{textStyle}{color} = AttrVal($name, "axisLabelColor", "#ffffff");
    }
    ## TODO gibt es weitere y3 und y4 Achsen?
${$eCharts_options_ref}{yAxis} = \@yAxis;


Und attr-list erweitern:
    my @attrList = qw(
          axisLabelColor
    backgroundColor
          legendColor
  encoding:1,0

Gruß schwatter