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.

    covid bell curve line graph tracker

    Scheduled Pinned Locked Moved Solved Requests
    89 Posts 6 Posters 63.0k Views 8 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.
    • rafaelcotaR Offline
      rafaelcota
      last edited by

      Looks great! I’m looking forward in using this module, but I just don’t get the chart dimensions to work, the size is always the same, big, and it doesn’t matter which region I use.

      This is my config

                  {
                                  disabled: false,
                                  module:"MyCovid19",
                                  position:"top_left",
                                  config:{
                                          countries:["Mexico"],
                                          line_colors:['red','white','green','yellow','blue'],
                                          chart_type:"cumulative_cases",
                                          chart_title:"Cumulative Cases",
                                          ranges:{min:0,max:10000,stepSize:1000},
                                          startDate: "03/01/2020",
                                          backgroundColor: "transparent",
                                          width: 300,
                                          height: 500,
                                          debug:false,
                                  },
                  },
      

      And this is the result, I’ll try to attach a screen capture, let’s see if I can!

      alt text

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

        @rafaelcota hm… I usually have this

        		{
        			module:"MyCovid19",
        			disabled:false,
        			position:"top_left",
        			config:{
        				states:["Michigan", 'Texas','Illinois', 'Florida','California','Louisiana','Washington','New York',],
        				// line colors can be any definition of color either a name ,or a hex string
        				// one per country above, used in order,
        				line_colors:['red','white','green','yellow','#34ebde','#34eb00','purple','orange'],
        				//				
        				chart_type:"deaths",  // or "cumulative deaths"
        				chart_title:"daily new deaths by state", // however u want to label
        				// the vertical steps on the chart.. how tall u want it to be and how mant increments 
        				ranges:{min:0,max:000,stepSize:10},
        				// size of the chart in pixels
        			    width: 400,
        			    height: 800,	
        			    // only used if we need to debug something
        			    //debug:true,
        			    startDate:'03/10/2020',
        			    debug:true,
        			//    startLabel:['2/1/2020','3/1/2020']
        			    //backgroundColor: 'white',
        			}
        		}
        

        400x 400 (w x h)
        alt text

        but changed to 400 x 800 (w x h)

        alt text

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        rafaelcotaR 1 Reply Last reply Reply Quote 1
        • S Offline
          sdetweil
          last edited by

          I added the calendar and changed to 300 x 800

          alt text

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 1
          • rafaelcotaR Offline
            rafaelcota @sdetweil
            last edited by

            @sdetweil I know, that’s how it supposed to work, but not in my mirror… It’s driving me crazy… I’ve tried almost everything…

            S 2 Replies Last reply Reply Quote 0
            • S Offline
              sdetweil @rafaelcota
              last edited by sdetweil

              @rafaelcota when was the last time you did a git pull?

              I just used your definition and changed height to 800 and it came out right… (wrong image before)
              alt text

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              rafaelcotaR 1 Reply Last reply Reply Quote 1
              • rafaelcotaR Offline
                rafaelcota @sdetweil
                last edited by

                @sdetweil I’ve just downloaded today, just a few minutes before I tried.

                This is what I’m seeing right now with the following config (tried with states now):

                            {
                                            disabled: false,
                                            module:"MyCovid19",
                                            position:"top_center",
                                            config:{
                                                    states:['Kentucky','Colorado','Arizona'],
                                                    line_colors:['red','white','green','yellow','blue'],
                                                    chart_type:"cumulative_cases",  // or "cumulative deaths"
                                                    chart_title:"Cumulative Cases", // however u want to label
                                                    ranges:{min:0,max:8000,stepSize:10000},
                                                    width: 200,
                                                    height: 300,
                                                    debug: true,
                                            },
                            },
                

                alt text

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

                  I don’t use any special classes

                            var c = document.createElement("div");   // < container for chart
                            c.style.width = self.config.width + "px";
                            c.style.height = self.config.height + "px";
                            self.wrapper.appendChild(c);
                  
                            canvas = document.createElement("canvas");   // < --- chart itself
                            canvas.id = "myChart" +self.ourID ;
                            canvas.style.width = (self.config.width -10) + "px";
                            canvas.style.height = self.config.height + "px";    
                            canvas.style.backgroundColor=self.config.backgroundColor;
                            c.appendChild(canvas);
                  

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @rafaelcota
                    last edited by sdetweil

                    @rafaelcota i don’t see it, but maybe there is a weird character between width and 400

                    so, take the space out, for both height and width

                    width:400,
                    height:800,
                    

                    how big is your screen?

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @rafaelcota
                      last edited by sdetweil

                      @rafaelcota great work!!..

                      for grins, edits the MyCovid19.js

                      line 168ish

                                if (!self.config.stacked)
                                  c.style.display = 'inline-block';
                      

                      comment out those two lines…

                      the prior module which I cloned had the ability to generate multiple charts at once,
                      but how that got set in your instance I have no idea…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      rafaelcotaR 1 Reply Last reply Reply Quote 0
                      • rafaelcotaR Offline
                        rafaelcota @sdetweil
                        last edited by

                        @sdetweil
                        This is what I’ve done so far:

                        I’ve deleted the spaces in height and width and numbers;
                        I’ve disabled ALL other modules, so this one runs alone;
                        I’ve commented out those two lines in MyCovid19.js

                        And all still the same…

                        It just gets the dimensions from wherever it gets them… so weird…

                        S rafaelcotaR 2 Replies Last reply Reply Quote 0
                        • S Offline
                          sdetweil @rafaelcota
                          last edited by

                          @rafaelcota but now it shouldn’t have inline-block applied, in the elements view

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          rafaelcotaR 1 Reply Last reply Reply Quote 0
                          • rafaelcotaR Offline
                            rafaelcota @rafaelcota
                            last edited by

                            @rafaelcota BTW, my resolution is 1920 x 1080 in an RPI 4

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              sdetweil @rafaelcota
                              last edited by

                              @rafaelcota and I am running this particular test on a 1920x1080 ubuntu… but my pi4 is just behind me at 3840x2160

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              1 Reply Last reply Reply Quote 0
                              • rafaelcotaR Offline
                                rafaelcota @sdetweil
                                last edited by

                                @sdetweil
                                It still there…
                                I’m sure you have better things to do than debug this with a user… I’m going to do a clean install, even if it does mean to use the brand new MM version (don’t have much installed, and have lots of time nowadays) and see what happens…

                                alt text

                                S A 2 Replies Last reply Reply Quote 0
                                • S Offline
                                  sdetweil @rafaelcota
                                  last edited by

                                  @rafaelcota use my installer script
                                  see here
                                  https://github.com/sdetweil/MagicMirror_scripts

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  rafaelcotaR 1 Reply Last reply Reply Quote 0
                                  • rafaelcotaR Offline
                                    rafaelcota @sdetweil
                                    last edited by

                                    @sdetweil Thank you…

                                    Used them… worked well.

                                    Did a clean install, use my old config and same thing happened.
                                    Change my config.js with original+MyCovid19 and ALL OK!

                                    So, I changed the original config.js with my modules, one by one and ALL went OK.

                                    So, I got curious, and then went to change the original config.js to my old one, module by module so I could find which one was interfering, and ALL went OK.

                                    UNTIL, and this is really strange, when I change the address of localhost at the beginning, it went to the same problem again.

                                    If I have address: “localhost”, ALL is OK
                                    If I have address: “0.0.0.0”, then the problem appears again.

                                    Any ideas?

                                    Here’s my mirror working OK
                                    alt text

                                    S bheplerB 2 Replies Last reply Reply Quote 0
                                    • S Offline
                                      sdetweil @rafaelcota
                                      last edited by

                                      @rafaelcota said in covid bell curve line graph tracker:

                                      If I have address: “localhost”, ALL is OK
                                      If I have address: “0.0.0.0”, then the problem appears again.

                                      and
                                      ipWhitelist:[],

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      rafaelcotaR 1 Reply Last reply Reply Quote 0
                                      • rafaelcotaR Offline
                                        rafaelcota @sdetweil
                                        last edited by

                                        @sdetweil I don’t understand how this parameters relate with the size of a graph.

                                        I think it’s weird, at least it kept me entertained for a couple of hours in quarantine. :)

                                        I hope you and your family and friends are OK.

                                        S 1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          sdetweil @rafaelcota
                                          last edited by

                                          @rafaelcota all ok here…

                                          i have no idea really on the parms affecting… all my pi systems use address:“0.0.0.0” and ipWhitelist:[]
                                          so I can open their pages on my pc at my desk. (easier to debug modules this way, run there , debug here)

                                          i can only think that something in the chart.js library is trying to get a file or something and there is a cross site scripting restriction to stop it…

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          1 Reply Last reply Reply Quote 0
                                          • bheplerB Offline
                                            bhepler Module Developer @rafaelcota
                                            last edited by bhepler

                                            @rafaelcota said in covid bell curve line graph tracker:

                                            @sdetweil Thank you…
                                            If I have address: “localhost”, ALL is OK
                                            If I have address: “0.0.0.0”, then the problem appears again.

                                            Yeah, 0.0.0.0 is not the IP address of your Pi. If you don’t want to use localhost, try the IP address of your Pi on your local network instead. (you can find the local IP address by entering ip address from your Pi) The Magic Mirror framework is a web server at heart, so it needs to understand what IP address it is using. You can try 127.0.0.1 as well, as that is the “local loopback” IP address. It always points to itself.

                                            S 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
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 2 / 5
                                            • 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