Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. Diagramm mehrerer Datenpunkte ohne History

    NEWS

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    Diagramm mehrerer Datenpunkte ohne History

    This topic has been deleted. Only users with topic management privileges can see it.
    • sigi234
      sigi234 Forum Testing Most Active @Negalein last edited by sigi234

      @Negalein sagte in Diagramm mehrerer Datenpunkte ohne History:

      @sigi234 sagte in Diagramm mehrerer Datenpunkte ohne History:

      Funktioniert nicht bei mir.

      Ich hab keinen DP javascript.0.vis.dasWetterTable

      Du brauchst das Skript von @paul53

      var path    = "daswetter.0.NextDaysDetailed.Location_1."; // Pfad der String-Datenpunkte aus "list"
      var idTable = "vis.dasWetterTable"; // Pfad des Datenpunkts für das vis-Json
      
      // Datenpunkte anlegen
      createState(idTable, "", {
        name: idTable,
        desc: 'Tabelle der Vorhersagewerte aus daswetter.com als Json-Objekt',
        type: 'string',
        unit: '',
        role: 'value'
      });
      
      function wetter() {
         var list = [];
         for(let i = 0; i < 8; i++) {
            list[i] = {};
            list[i].Zeit = getState(path + 'Day_1.Hour_' + (i + 1) + '.hour_value').val;
            list[i].Heute = getState(path + 'Day_1.Hour_' + (i + 1) + '.temp_value').val;
            list[i].Morgen = getState(path + 'Day_2.Hour_' + (i + 1) + '.temp_value').val;
            list[i].Tag_2 = getState(path + 'Day_3.Hour_' + (i + 1) + '.temp_value').val;
            list[i].Tag_3 = getState(path + 'Day_4.Hour_' + (i + 1) + '.temp_value').val;
            list[i].Tag_4 = getState(path + 'Day_5.Hour_' + (i + 1) + '.temp_value').val;
         }   
         var json = JSON.stringify(list);
         // log(json);
         setState(idTable, json, true);
      }
      
      // Trigger
      schedule('10 */15 * * * *', wetter);
      
      Negalein 1 Reply Last reply Reply Quote 1
      • Negalein
        Negalein Global Moderator @sigi234 last edited by

        @sigi234

        Danke!
        Ich hatte das von @dtp

        1 Reply Last reply Reply Quote 0
        • Negalein
          Negalein Global Moderator last edited by

          @sigi234

          Hast du die Zeile für die Einheiten (°C, km/h, %, mm) schon eingefügt?
          Wo gehört das im Script von @paul53 eingetragen?

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Negalein last edited by paul53

            @Negalein sagte:

            Wo gehört das im Script von @paul53 eingetragen?

            Das Skript liefert nur die Temperaturwerte. Mit °C:

                  list[i].Heute = getState(path + 'Day_1.Hour_' + (i + 1) + '.temp_value').val + ' °C';
                  list[i].Morgen = getState(path + 'Day_2.Hour_' + (i + 1) + '.temp_value').val + ' °C';
                  list[i].Tag_2 = getState(path + 'Day_3.Hour_' + (i + 1) + '.temp_value').val + ' °C';
                  list[i].Tag_3 = getState(path + 'Day_4.Hour_' + (i + 1) + '.temp_value').val + ' °C';
                  list[i].Tag_4 = getState(path + 'Day_5.Hour_' + (i + 1) + '.temp_value').val + ' °C';
            
            Negalein 1 Reply Last reply Reply Quote 0
            • Negalein
              Negalein Global Moderator @paul53 last edited by

              @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

              @Negalein sagte:

              Wo gehört das im Script von @paul53 eingetragen?

              Das Skript liefert nur die Temperaturwerte. Mit °C:

              Könnte man das auf die anderen Werte noch erweitern?

              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Negalein last edited by

                @Negalein sagte:

                Könnte man das auf die anderen Werte noch erweitern?

                Wie soll die Tabelle dann aussehen ? Oder mehrere Tabellen ?

                Negalein 1 Reply Last reply Reply Quote 0
                • Negalein
                  Negalein Global Moderator @paul53 last edited by Negalein

                  @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

                  @Negalein sagte:

                  Könnte man das auf die anderen Werte noch erweitern?

                  Wie soll die Tabelle dann aussehen ? Oder mehrere Tabellen ?

                  So wie die Tabelle von @dtp ungefähr
                  Beispiel

                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Negalein last edited by

                    @Negalein 40 Zeilen ?

                    Negalein 1 Reply Last reply Reply Quote 0
                    • Negalein
                      Negalein Global Moderator @paul53 last edited by

                      @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

                      @Negalein 40 Zeilen ?

                      So zB hätte ich gedacht
                      Screenshot 2019-08-22 14.10.17.png

                      paul53 1 Reply Last reply Reply Quote 0
                      • D
                        dtp last edited by dtp

                        Hier gingen jetzt zwei Sachen durcheinander. Zum Einen das Skript von @paul53 zur Erstellung einer JSON-Tabelle und dann meine Version, die die Grundlage für charts.js bilden sollte. Das sollten wir vielleicht klarer trennen.

                        Mir ging es in erster Linie um eine grafische Darstellung der Vorhersagewerte. Eine JSON-Tabelle ist da ggf. nicht so zielführend, zumal man die Werte ja auch problemlos einzeln mit entsprechenden Widgets als Tabelle darstellen kann.

                        @paul53: hab die Units aus den Array-Datenpunkten ebenfalls entfernt. Danke für den Hinweis.

                        Hab mir nun mal charts.js mit

                        npm install chart.js --save
                        

                        installiert. Unter node_modules befinden sich auch die entsprechenden charts.js-Verzeichnisse. Doch nun stocke ich bei der Erstellung des entsprechenden Skripts mit

                        require(['chart.js/dist/Chart.js'], function(Chart){
                          var myChart = new Chart(ctx, {...});
                        });
                        

                        Wie und wo zeige ich die entsprechenden Daten an? Jemand eine Idee?

                        Negalein 1 Reply Last reply Reply Quote 0
                        • Negalein
                          Negalein Global Moderator @dtp last edited by

                          @dtp sagte in Diagramm mehrerer Datenpunkte ohne History:

                          Mir ging es in erster Linie um eine grafische Darstellung der Vorhersagewerte.

                          Ja, das möchte ich auch!
                          Mit dem Script von @paul53 funktioniert das leider nicht.

                          1 Reply Last reply Reply Quote 0
                          • paul53
                            paul53 @Negalein last edited by paul53

                            @Negalein sagte:

                            So zB hätte ich gedacht

                            Versuche es mal so (nicht getestet)

                            var path    = "daswetter.0.NextDaysDetailed.Location_1.Day_"; // Pfad der String-Datenpunkte aus "list"
                            var idTable = "vis.dasWetterTable"; // Pfad des Datenpunkts für das vis-Json
                            
                            // Datenpunkte anlegen
                            createState(idTable, "", {
                              name: idTable,
                              desc: 'Tabelle der Vorhersagewerte aus daswetter.com als Json-Objekt',
                              type: 'string',
                              role: 'json'
                            });
                            
                            function wetter() {
                               var list = [];
                               for(let i = 0; i < 20; i++) {
                                  var j = i % 4;
                                  var sensor = 'temp_value';
                                  var unit = '°C';
                                  if(j == 1) {
                            	     sensor = 'humidity_value';
                            	     unit = '%rH';
                                  } 
                                  else if(j == 2) {
                            	     sensor = 'rain_value';
                            	     unit = 'mm';
                                  }		 
                                  else if(j == 3) {
                            	     sensor = 'wind_value';
                                         unit = 'km/h';
                                  }		 
                                  var day = Math.floor(i / 4);
                                  var tage = ['Heute','Morgen','Tag 2','Tag 3','Tag 4']
                                  list[i] = {};
                                  if(j == 0) list[i].Tag = tage[day];
                                  list[i].Sensor = unit;
                                  day = day + 1;
                                  list[i]['02:00'] = getState(path + day + '.Hour_1.' + sensor).val;
                                  list[i]['05:00'] = getState(path + day + '.Hour_2.' + sensor).val;
                                  list[i]['08:00'] = getState(path + day + '.Hour_3.' + sensor).val;
                                  list[i]['11:00'] = getState(path + day + '.Hour_4.' + sensor).val;
                                  list[i]['14:00'] = getState(path + day + '.Hour_5.' + sensor).val;
                                  list[i]['17:00'] = getState(path + day + '.Hour_6.' + sensor).val;
                                  list[i]['20:00'] = getState(path + day + '.Hour_7.' + sensor).val;
                                  list[i]['23:00'] = getState(path + day + '.Hour_8.' + sensor).val;
                               }   
                               var json = JSON.stringify(list);
                               // log(json);
                               setState(idTable, json, true);
                            }
                            
                            // Trigger
                            schedule('10 */15 * * * *', wetter);
                            
                            
                            Negalein 1 Reply Last reply Reply Quote 0
                            • Negalein
                              Negalein Global Moderator @paul53 last edited by

                              @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

                              @Negalein sagte:

                              So zB hätte ich gedacht

                              Versuche es mal so (nicht getestet)

                              Funktioniert leider nicht.
                              Aber egal. Ich versuchs irgendwie grafisch umzusetzen.

                              Danke
                              Edit vis (2).png

                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @Negalein last edited by

                                @Negalein
                                Ändere mal

                                      if(j == 0) list[i].Tag = tage[day];
                                

                                in

                                      if(j == 0) list[i].Tag = tage[day];
                                      else list[i].Tag = '';
                                
                                sigi234 1 Reply Last reply Reply Quote 0
                                • sigi234
                                  sigi234 Forum Testing Most Active @paul53 last edited by sigi234

                                  @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

                                  @Negalein
                                  Ändere mal

                                        if(j == 0) list[i].Tag = tage[day];
                                  

                                  in

                                        if(j == 0) list[i].Tag = tage[day];
                                        else list[i].Tag = '';
                                  

                                  Schaut bei mir so aus:

                                  Screenshot (3913).png

                                  Edit:

                                  Screenshot (3915).png

                                  paul53 1 Reply Last reply Reply Quote 0
                                  • D
                                    dtp last edited by

                                    Also das finde ich aber ehrlich gesagt alles andere, als übersichtlich. Da würde ich lieber bei der Ansicht aus meinem Ausgangsposting bleiben.

                                    Eigentlich schwebte mir eher sowas vor:

                                    2019-08-22_16h58_31.png

                                    Negalein 1 Reply Last reply Reply Quote 0
                                    • paul53
                                      paul53 @sigi234 last edited by

                                      @sigi234 sagte:

                                      Edit:

                                      Passt doch zur Excel-Tabelle von @Negalein.

                                      sigi234 1 Reply Last reply Reply Quote 0
                                      • sigi234
                                        sigi234 Forum Testing Most Active @paul53 last edited by

                                        @paul53 sagte in Diagramm mehrerer Datenpunkte ohne History:

                                        @sigi234 sagte:

                                        Edit:

                                        Passt doch zur Excel-Tabelle von @Negalein.

                                        Ja sag ich eh...........👍

                                        1 Reply Last reply Reply Quote 0
                                        • Negalein
                                          Negalein Global Moderator @dtp last edited by

                                          @dtp sagte in Diagramm mehrerer Datenpunkte ohne History:

                                          Eigentlich schwebte mir eher sowas vor:

                                          2019-08-22_16h58_31.png

                                          Mir auch!
                                          Eventuell wird es ja noch was! 🙂

                                          1 Reply Last reply Reply Quote 0
                                          • paul53
                                            paul53 @dtp last edited by

                                            @dtp sagte:

                                            Oh, hab da was gefunden. Klick!

                                            Bist Du damit nicht weiter gekommen ?

                                            S 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            917
                                            Online

                                            32.1k
                                            Users

                                            80.6k
                                            Topics

                                            1.3m
                                            Posts

                                            flot adapter vis
                                            6
                                            45
                                            2886
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo