MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    gauge.js

    Scheduled Pinned Locked Moved General Discussion
    16 Posts 3 Posters 7.7k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      Charley Module Developer
      last edited by Charley

      You may need a start!

      start: function () {
          
      },
      

      MMM-Bose-Soundtouch, MMM-Domoticz, MMM-crypto-portfolio, MMM-Fibaro, MMM-rain-forecast

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sispheor @Charley
        last edited by sispheor

        @Charley yes, I haven’t shown it but it’s present.

        1 Reply Last reply Reply Quote 0
        • C Offline
          Charley Module Developer
          last edited by

          What is the code in your start.
          I expect you don’t add the wrapper to the dom

          MMM-Bose-Soundtouch, MMM-Domoticz, MMM-crypto-portfolio, MMM-Fibaro, MMM-rain-forecast

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sispheor @Charley
            last edited by

            @Charley here is the code
            https://github.com/Sispheor/MMM-BMP-sensor/blob/dev/MMM-BMP-sensor.js

            1 Reply Last reply Reply Quote 0
            • C Offline
              Charley Module Developer
              last edited by Charley

              @sispheor Is everything invisible or just the gauge?
              Do you see pressure or temperatures?
              What is in your console.log from

              console.log('adafruit_python_bpm.py results: %j', results[0]);
              

              MMM-Bose-Soundtouch, MMM-Domoticz, MMM-crypto-portfolio, MMM-Fibaro, MMM-rain-forecast

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sispheor @Charley
                last edited by

                @Charley Yes the table is visible. Only the gauge doesn’t appear.

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Charley Module Developer
                  last edited by Charley

                  Okay I might have an idea

                  Change your createElement part to

                  let mycanvas = document.createElement("div");
                  mycanvas.id=("divcanvas")
                  let target=document.getElementById("divcanvas")
                  
                  

                  MMM-Bose-Soundtouch, MMM-Domoticz, MMM-crypto-portfolio, MMM-Fibaro, MMM-rain-forecast

                  S 2 Replies Last reply Reply Quote 0
                  • S Offline
                    sispheor @Charley
                    last edited by

                    @Charley OK thanks, I’ll try this in a couple minutes.

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sispheor @Charley
                      last edited by sispheor

                      @Charley Doesn’t work…

                      Uncaught TypeError: Cannot read property 'getContext' of null
                      
                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        Charley Module Developer
                        last edited by Charley

                        Maybe you could try this

                        let mycanvas = document.createElement("canvas");   // changed from div to canvas
                        mycanvas.id=("divcanvas")
                        let target=document.getElementById("divcanvas")
                        

                        I made a typo yesterday

                        MMM-Bose-Soundtouch, MMM-Domoticz, MMM-crypto-portfolio, MMM-Fibaro, MMM-rain-forecast

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sispheor @Charley
                          last edited by

                          @Charley yes it’s what I tried…

                          1 Reply Last reply Reply Quote 0
                          • S Offline
                            sispheor
                            last edited by

                            I tried with another lib called canvas-gauges. It’s the same. The canvas doesn’t appear on the screen
                            0_1522616850740_invisible_canvas.png

                            I’m wondering if a parent CSS config or something like could be the reason.

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              sispheor
                              last edited by

                              It’s good it works!! For the last lib I just forgot to call the draw method.

                              1 Reply Last reply Reply Quote 0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • 1 / 1
                              • First post
                                Last post
                              Enjoying MagicMirror? Please consider a donation!
                              MagicMirror created by Michael Teeuw.
                              Forum managed by Sam, technical setup by Karsten.
                              This forum is using NodeBB as its core | Contributors
                              Contact | Privacy Policy