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?
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 …
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?
Good to know! Thanks a lot 🙂
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?)
Thank you for answering my questions. Just to be clear, there is no way to call text ‘Monday’ instead of number ‘1’. Right?
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.
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.
Are either of these options useful?
- This reply was modified 2 years, 10 months ago by dgteam.
That was super helpful. Thanks for answering and uploading a new example! I learn a lot from those online examples 🙂
Great – and thanks for the feedback – we will keep posting more examples!
You must be logged in to reply to this topic.