HighCharts - Column style, interval of 5 minutes - highcharts

I want to display a Highcharts.com column-style chart with a column interval of exactly 5 minutes. My database contains data for every minute. Now I see irregular gaps of sometimes 6 or 7 minutes in my chart. So e.g. 10:05 a.m., 10:10 a.m., 10:16 a.m., 10:21 a.m., etc. etc. Where do these gaps come from and why is the data not consistently read from the database from 0:00 a.m. to 12:59 p.m. in 5 minute intervals?

Related

Pull data from big query to google sheet every Sunday at 11:59 pm for the last 21 days

It needs to pull data from BigQuery to Google Sheets every Sunday at 11:59 pm for the last 21 days.
Here's the code I wrote to find out Sunday.
SELECT
 EXTRACT(YEAR FROM date) AS year,
 week,
 name,
 parent_name,
 sum(total_sales) as total_revenue,
 title
 FROM partitioned_ts
WHERE
 id=14213
 and
 total_sales>0
 and
date BETWEEN DATE_SUB(CURRENT_DATE(), 
             INTERVAL 
             IF( EXTRACT(DAYOFWEEK FROM CURRENT_DATE()) = 1, 
                 6, 
                 EXTRACT(DAYOFWEEK FROM CURRENT_DATE()) - 1) 
             DAY) - INTERVAL 21 DAY AND DATE_SUB(CURRENT_DATE(), 
             INTERVAL 
             IF( EXTRACT(DAYOFWEEK FROM CURRENT_DATE()) = 1, 
                 6, 
                 EXTRACT(DAYOFWEEK FROM CURRENT_DATE()) - 1) 
             DAY)
GROUP BY name, parent_name, week, year, title
order by year DESC, week DESC, name
This query will process 85.31 GB when run. The old version of the query calculates the last 21 days from today
date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 21 DAY) AND CURRENT_DATE(
and this query processes only 1.6 GB when run. How should I write the query to process lower data?
The easiest way to filter out rows older than 21 days would be:
DATE_DIFF(CURRENT_DATE(), date, DAY) <= 21
If you need to reduce the scan size, the best approach is to partition the source table by date
https://cloud.google.com/bigquery/docs/querying-partitioned-tables#use_a_constant_filter_expression
The following code works:
date BETWEEN DATE_SUB((DATE_TRUNC(CURRENT_DATE(), WEEK(Saturday))), INTERVAL 21 DAY) AND (DATE_TRUNC(CURRENT_DATE(), WEEK(Saturday)))

Excel date-time auto fill error

I have data of 10 metrics for a 24 hour period which is in 5 minute intervals. I merged all the 10 data metrics into one file and converted it into a .xlsx file.
After opening the excel file I created date-time column, filled 2 values and tried to fill the rest with Auto-fill option in excel. But the problem is after several rows the 5 minute interval changes to 4 minute interval,
Example:
18-11-2019 10:10
18-11-2019 10:15
If I try to auto-fill this data till the last column this is how the data changes,
18-11-2019 10:10
18-11-2019 10:15
18-11-2019 10:20
18-11-2019 10:25
.
.
.
18-11-2019 12:15
18-11-2019 12:19
18-11-2019 12:24
18-11-2019 12:29
When I click the 12:19 row, It shows 18-11-2019 12:19:59.
It'd be helpful if someone explains why this problem occurs, and the solution?

Spotfire Day Counter Time Series

I am attempting to load some oil and gas production data into spotfire. This data is currently in a time series, ie one column has well name, another has production values (bbls) and then one column has months and another years( I also have a concatenate month/year column). I would like to create another calculated column that contains a day counter, I.e. May 1974 would be day 1 and then June 1974 would be day 32 and so forth.
In excel I would do this with an if statement and reference preceding cells, but being a bit new to spotfire I am unsure how to do this.
Could someone please point me in the right direction? Suggest some functions?
Thanks for the response scsimon.
I solved my problem by creating a case statement for the days in each month and then summing over the days per well for all rowIDs.
case [Month] WHEN "JAN" then 31 when "FEB" then 28 when "MAR" then 31 when "APR" then 30 when "MAY" then 31 when "JUN" then 30 when "JUL" then 31 when "AUG" then 31 when "SEP" then 30 when "OCT" then 31 when "NOV" then 30 when "DEC" then 31 end
Sum([c.Days in Month]) over (Intersect([Entity],AllPrevious([c.rowID])))
This gave me the desired response.

How to determine the current week in a Google Calendar sidebar gadget

I am writing a Google Calendar sidebar gadget to keep track of the total hours per event tag (as determined in details of the event i.e. "tags: work").
Users can change the current week, month, day they are viewing in the calendar and I want to be able to count up the hours pertaining to their current view.
I don't see anywhere in the gadget API (or any other Google Calendar API) that allows gadgets to access the currently displayed view. I have noticed that the URL has an anchor tag that looks like
g|week-2+23127+23137+23131
which corresponds to viewing Monday Feb. 23, 2015 - Sunday March 1, 2015 in week mode.
I have also noticed the following relationships:
23127 is the first day in the view
23137 is the last day in the view
23131 is the day selected in the month view (on the left of the calendar)
If there is a way to get the currently displayed view using the API, that would be ideal but I would settle for parsing the anchor tag. Unfortunately I cannot decipher how the numbers work.
Google API
The currently displayed date range can be accessed using the following call:
google.calendar.subscribeToDates(function(d) {
// do something
});
where d is a Google date range d.startTime and d.endTime being the beginning and end.
Numbers
The numbers in the URL do not correspond directly to epoch date and time. Rather, each year has 512 days associated with it and each month has 32 days. For example, February has 28 days regularly but every leap year it has 29. The calendar never has to adjust for this since it simply allots each month 32 days and comes out with a nice even number every time.
A careful examination of the date ranges displayed will also show you that if you subtract the number for December 31 from January 1 you get 130. Accounting for the beginning and the end (don't count December 31 and January 1) will give you 128.
12 * 32 + 128 = 512 -- 12 months a year, 32 days a month and a 128 gap per year
Also, for some reason January 1, 1970 has the associated number of 33 so add that to your calculations when determining dates.
This wouldn't fit in the comments, but here's how the encoding works:
The encoding scheme makes it easy to find the day/month/year from the number.
Take 23131 which yields Feb 27, 2015 (from the example in your question).
Divide by 512 and add 1970 (epoch) for the year.
23131 / 512 = 45.xxx => 45 + 1970 = 2015.
Get the remainder of that division and divide by 32 to find the month.
23131 mod 512 = 91 / 32 = 2.xxx = February
Get the remainder of that division and it's the day.
91 mod 32 = 27

Why is the timestamp in UIDatePicker always off by a few seconds?

I'm pulling a timestamp out of a UIDatePicker like so:
datePicker.date.timeIntervalSince1970
The timestamps are always off by a seemingly random number of seconds. Given that the UI specifies a whole number of minutes, I'd expect that number to be divisible by 60. For example here's what I just got out of the debugger:
(lldb) po self.datePicker.date.timeIntervalSince1970
1396655124
That number corresponds to Fri, 04 Apr 2014 23:45:24 GMT. Where did the 24 seconds come from?
Per wikipedia, "[b]etween their adoption in 1972 and June 2012, 25 leap seconds have been scheduled, all positive."
I'd assume that's where the extra seconds have come from.

Resources