Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. Google charts in visualization

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Google charts in visualization

    This topic has been deleted. Only users with topic management privileges can see it.
    • KarolisL
      KarolisL last edited by

      Hello,

      does anybody have an idea how to render google charts?
      In editor everything seems to be ok, but in visualization debug window I get these errors

      Error: can't render tplHtml w00006 on "TEST": 
      conn.js:1137 Error: 0 - ReferenceError: google is not definedReferenceError: google is not defined
      conn.js:1137 Error: 1 -     at eval (eval at <anonymous> (http://localhost:8082/lib/js/jquery-1.11.2.min.js:2:2622), <anonymous>:2:7)
      conn.js:1137 Error: 2 -     at eval (<anonymous>)
      conn.js:1137 Error: 3 -     at http://localhost:8082/lib/js/jquery-1.11.2.min.js:2:2622
      conn.js:1137 Error: 4 -     at Function.globalEval (http://localhost:8082/lib/js/jquery-1.11.2.min.js:2:2633)
      conn.js:1137 Error: 5 -     at m.fn.init.domManip (http://localhost:8082/lib/js/jquery-1.11.2.min.js:3:23107)
      conn.js:1137 Error: 6 -     at m.fn.init.t.fn.domManip (http://localhost:8082/vis/lib/js/can.custom.min.js:28:2469)
      conn.js:1137 Error: 7 -     at m.fn.init.append (http://localhost:8082/lib/js/jquery-1.11.2.min.js:3:20620)
      conn.js:1137 Error: 8 -     at Object.renderWidget (http://localhost:8082/vis/js/vis.js:1465:27)
      conn.js:1137 Error: 9 -     at http://localhost:8082/vis/js/vis.js:739:120
      conn.js:1137 Error: 10 -     at http://localhost:8082/vis/js/vis.js:2560:31
      hqwidgets.js:899 Version vis-hqwidgets: 1.1.2
      loader.js?_=1556481690293:229 Uncaught Error: Google Charts loader.js can only be loaded once.
          at loader.js?_=1556481690293:229
          at loader.js?_=1556481690293:233
      (anonymous) @ loader.js?_=1556481690293:229
      (anonymous) @ loader.js?_=1556481690293:233
      2VM6327:20 Uncaught (in promise) TypeError: google.visualization.PieChart is not a constructor
          at drawChart (eval at <anonymous> (jquery-1.11.2.min.js:2), <anonymous>:20:21)
      

      Code is:

      <html>
        <head>
          <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
          <script type="text/javascript">
            google.charts.load('current', {'packages':['corechart']});
            google.charts.setOnLoadCallback(drawChart);
      
            function drawChart() {
      
              var data = google.visualization.arrayToDataTable([
                ['Task', 'Hours per Day'],
                ['Work',     11],
                ['Eat',      2],
                ['Commute',  2],
                ['Watch TV', 2],
                ['Sleep',    7]
              ]);
      
              var options = {
                title: 'My Daily Activities'
              };
      
              var chart = new google.visualization.PieChart(document.getElementById('piechart'));
      
              chart.draw(data, options);
            }
          </script>
        </head>
        <body>
          <div id="piechart" style="width: 900px; height: 500px;"></div>
        </body>
      </html>
      
      1 Reply Last reply Reply Quote 0
      • Mic
        Mic Developer last edited by Mic

        I had the same issue, Google charts was not working reliable when using the HTML Basic widget in vis.
        Therefore, I generate an html file using the Javascript adapter and display it within an iframe widget. This way, it works perfectly, and I can also use all functions like getState(), etc.

        Example script: https://forum.iobroker.net/topic/22779/vorlage-google-charts-beispiel

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

        Support us

        ioBroker
        Community Adapters
        Donate

        862
        Online

        31.9k
        Users

        80.3k
        Topics

        1.3m
        Posts

        vis
        2
        2
        342
        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