Animation varying date

Welcome to our Forums Technical Support Support Desk Animation varying date

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #3113
    SingingKim
    Participant

      Hi,

      First of all, I always appreciate your prompt feedback.

      My graph contains hourly data for each day, and I’m trying to generate an animation changing a date.

      I put “2019:01:01,2019:12:31” into a range section in the bottom left animation. And it shows a proper graph on the plot section. It even works just fine with a horizontal scroll bar and I can see how the date is changing.

      However, when I play the animation, it does not plot any graph. Also, the number attains a weird value like 1.56666e9.

      Can I get any help with this?

      Thanks!

      Screen Shot 2020-01-20 at 1.20.25 PMScreen Shot 2020-01-20 at 1.20.13 PM

       

      #3114
      dgteam
      Moderator

        Your welcome – I’m sure we can get this working 🙂

        The issue is related to the fact that dates are saved as the seconds since the first day in 1970.(See Unix time on Wikipedia for more information).

        The slider is set up to snap to the nearest day as you move, but when you hit play, the animation variable (t) moves forward in seconds. That is why you see that number that is so large.

        If you want to move incrementally between days, you can use an Expression variable to snap to the nearest day as ‘t’ in seconds is changing.

        Here is an example …

        Annimate-Date-Example

        In this expression variable above …

        s = seconds in a day

        sec = the rounded seconds calculated from ‘t’, that will correspond to the nearest day (no hrs, mins, or sec)

        The remaining entries are used to show the exact, year, month, and day, so you can confirm it is returning the value you want.

        Change your mask to use the ‘day’ variable instead of the ‘t’.

        Does this work now?

         

        #3115
        SingingKim
        Participant

          Good to know! Thanks a lot 🙂

          #3116
          SingingKim
          Participant

            Let me ask one follow-up question. Is there a function to return what day of a week is? (e.g. f(sec) = Monday or something?)

            #3117
            dgteam
            Moderator

              Yes – the function is called ‘dayofweek’.  It will return a number from 1 to 7. Returns 1 for a Monday, 7 for Sunday.

              Here is a link to the full list of built-in functions for Data & Time.

               

              #3118
              SingingKim
              Participant

                Thank you for answering my questions. Just to be clear, there is no way to call text ‘Monday’ instead of number ‘1’. Right?

                #3132
                dgteam
                Moderator

                  You could take the dayofweek() function to create a numerical representation of the day of week, and then use a Map column to map the numbers to a text.

                  DayofWeek_Example2

                  OR

                  Another way  is to change the display of the Date column to a day of the week.

                  See more information in the Date column section on Displaying dates.  Note that the underlying data is still a date (seconds from 1970), you are just changing the display.

                  Next, take the displayed day of week and use a Text expression column to get a text column that can be used in masks, etc.

                  FYI – We just uploaded an example file that demonstrates how you take a date column and get a text column with day of the week, using this approach.

                  DayofWeek_Example

                  Are either of these options useful?

                  • This reply was modified 4 years, 3 months ago by dgteam.
                  #3137
                  SingingKim
                  Participant

                    That was super helpful. Thanks for answering and uploading a new example! I learn a lot from those online examples 🙂

                    #3158
                    dgteam
                    Moderator

                      Great – and thanks for the feedback – we will keep posting more examples!

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.

                    Welcome to our Forums Technical Support Support Desk Animation varying date