Administrators Lindsey.Wilcox Posted November 24, 2020 Administrators Share Posted November 24, 2020 Background I would like to create a Histogram that displays the average temperature for each hour during the night shift (8 PM - 8 AM). However, when I configure a Histogram to aggregate based on the hour of the day, the bins are displayed in numerical order, not chronological order: The following steps describe how to display the bins in chronological order. Solution 1. Create an Hourly Periodic Condition 2. Use the Formula tool to assign a property to each capsule in the Hours condition that indicates the start date and time of each capsule; this will create a new condition that can be used to aggregate the histogram. $hours.transform($capsule -> $capsule.setProperty('startDateTime', $capsule.property('Start'))) (NOTE: By default, each capsule in any condition has a 'Start' property. However, this property can not be used in histogram aggregations, which is why this step is required.) 3. Aggregate the Histogram using the condition and capsule properties defined in Step 2. While the bins are now displayed in chronological order, the date and time displayed are in UTC time. To display the time consistent with your time zone, edit the 'Hours with Property' condition to include the time zone conversion. In the following screenshot, I am converting from UTC to EST and removing the 'Z' displayed at the end of the timestamp. $hours.transform($capsule -> $capsule.setProperty('startDateTime', (((($capsule.property('Start'))-5h).tostring().replace('Z',''))))) The histogram bins now display in chronological order, with the timestamps in the correct (EST) timezone. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now