Highcharts Plotline feature - highcharts

I was wondering whether it'd be possible to draw multiple y axis plotlines on specific dates using highcharts.
I have 3 lines with different colors, one from 16 Apr to 30 Apr and the second one from 30 Apr to 28 May, the third from 28 May to 25 Jun
something similar to this :
Thanks for your help.
H

Related

Summation Function in Google Sheets

I have data which can be used to find the amount of snowfall in a particular month.
MONTH SNOWFALL INDEX
Jan 0.25
Feb 0.1
Mar 0.6
Apr 0.99
May 0.2
Jun 0.2
Jul 0.01
Aug 0.09
Sep 1.0
Oct 0.5
Nov 0.8
Dec 0.39
To calculate how much snow falls in each month, I have the following formula:
snowfall_amount = (130 - snowfall_index) / 90
I want to write a formula which adds up the amount of snowfall between the months of march and april. Normally, I would create a third column and make the formula:
=130 - $B2 / 90
and then drag that formula down. Then my solution would be:
=SUM($C5:$C6)
However here I am looking for a one-cell solution. Intuitively it seems like this is the job for a Summation but I don't see any way to do that through formulas.
Try
=ArrayFormula(sum((130-index(B2:B,match(C2,A2:A,0)):index(B2:B,match(D2,A2:A,0)))/90))

Google sheets importHTML removes zero and treats commas as decimal

I'm trying to import a table where the commas are the 1000 separator,
example: 32,100 is 32100 but it is treating it as 32.1 instead.
This is a similar table (first one / top left):
https://en.wikipedia.org/wiki/Demographics_of_the_world
imgur for screenshots:
https://imgur.com/a/hJR9tox
I want it to say:
Year million
1500 458
1600 580
1700 682
1750 791
1800 978
1850 1262
1900 1650
1950 2521
1999 5978
2008 6707
2011 7000
2015 7350
2018 7600
2020 7750
But it comes out as:
Year million
1500 458
1600 580
1700 682
1750 791
1800 978
1850 1,262
1900 1,65
1950 2,521
1999 5,978
2008 6,707
2011 7
2015 7,35
2018 7,6
2020 7,75
This is the function I'm using:
=IMPORTHTML("https://en.wikipedia.org/wiki/Demographics_of_the_world"; "table"; 1)
I have also tried using this function:
=IMPORTXML("https://en.wikipedia.org/wiki/Demographics_of_the_world"; "//*[#id='mw-content-text']/div/table[1]/tbody")
But that shows as this witch is extremely hard to understand since it looks like this and still removes the zeros:
World Population[1][2] Yearmillion 1500458 1600580 1700682 1750791 1800978 18501,262 19001,65 19502,521 19995,978 20086,707 20117 20157,35 20187,6 20207,75
Other things i have tried is:
forsing it to always print out three decimals, that wont work since it adds more numbers to the end of all numbers.
The main & easiest possible solution that you have is to change your Spreadsheet's locale setting to one that uses the , as mile separator.
As an alternative, if changing this setting is really not a possibility, you could create a script that uses URLFetchApp to retrieve the page's contents and parses the values, taking into considerations the usage of , as mile separator.

How to create a indicator that loops through date and unique client ID?

The data structure is as follows:
Cli_ID M_YR trans-Date First_Trans
1004525 Oct 17 30-Oct-17 20-Sep-17
1004570 Oct 17 02-Oct-17 30-Aug-17
1004570 Oct 17 05-Oct-17 30-Aug-17
1004570 Oct 17 10-Oct-17 30-Aug-17
1004570 Oct 17 11-Oct-17 30-Aug-17
1004570 Oct 17 12-Oct-17 30-Aug-17
1004570 Oct 17 13-Oct-17 30-Aug-17
1004570 Oct 17 17-Oct-17 30-Aug-17
1004570 Oct 17 19-Oct-17 30-Aug-17
1004570 Oct 17 23-Oct-17 30-Aug-17
1004570 Oct 17 24-Oct-17 30-Aug-17
1004570 Oct 17 25-Oct-17 30-Aug-17
1143578 Oct 17 13-Oct-17 07-Sep-17
1143578 Oct 17 18-Oct-17 07-Sep-17
1143578 Oct 17 19-Oct-17 07-Sep-17
I need to identify all clients who have had at least one transaction per month. I am thinking, based on their first transaction date, calculate how many month they should have had at least one transaction for (Count_month) (eg., if client first transaction is Sept 2017, so from October 2017 to June 2019, the number of month they need to have at least one transaction in is 21).
And then create another counter to loop through each M_YR (month, year), and add 1 if a unique client had a transaction in a given Month-year (Count_client)...(eg., if client had at least one transaction a month from October 2017 to June 2019, the counter would be 21)
If I compare these two variables (Count_client and Count_month), if Count_client < Count_month then i will know this client did not have at least one transaction per month.
Does this method work? is there an easier way to do this? I feel this is probably not the simplest solution but I am currently out of ideas..
To calculate the number of months between first transaction and present date you can use:
compute Months_since_1st = datediff($time, First_Trans, "months").
(the $Time expression will use present date in calculation - you can replace that with any other date).
To calculate the number of months that had any transaction:
dataset name orig.
* identifying every month/year that had transactions - per client.
dataset declare agg1.
aggregate out=agg1 /break=Cli_ID M_YR /n=n.
dataset activate agg1.
* counting them for each client.
dataset declare agg2.
aggregate out=agg2 /break=Cli_ID /Nmonths_with_transactions=n.
* attaching the results back to original data.
dataset activate orig.
match files /file = * /table = agg2 / by Cli_ID.

Savitzky - Golay filter for 2D Matrices

i am doing some research about implementing a Savitzky-Golay filter for images. As far as i have read, the main application for this filter is signal processing, e.g. for smoothing audio-files.
The idea is fitting a polynomial through a defined neighbourhood around point P(i) and setting this point P to his new value P_new(i) = polynomial(i).
The problem in 2D-space is - in my opinion - that there is not only one direction to do the fitting. You can use different "directions" to find a polynomial. Like for
[51 52 11 33 34]
[41 42 12 24 01]
[01 02 PP 03 04]
[21 23 13 43 44]
[31 32 14 53 54]
It could be:
[01 02 PP 03 04], (horizontal)
[11 12 PP 23 24], (vertical)
[51 42 PP 43 54], (diagonal)
[41 42 PP 43 44], (semi-diagonal?)
but also
[41 02 PP 03 44], (semi-diagonal as well)
(see my illustration)
So my question is: Does the Savitzky-Golay filter even make sense for 2D-space, and if yes, is there and any defined generalized form for this filter for higher dimensions and larger filter masks?
Thank you !
A first option is to use SG filtering in a separable way, i.e. filtering once on the horizontal rows, then a second time on the vertical rows.
A second option is to rewrite the equations with a bivariate polynomial (bicubic f.i.) and solve for the coefficients by least-squares.

How to QUERY a Spreadsheet by Row value

I Have a table in my spreadsheet like this
FEB MAR APR MAY
10 14 7 13
12 9 8 19
15 11 14 16
And I want to use this info in another table. What I want to accomplish is in this another table compare two months by getting this info with the name of the month.
FEB APR
10 7
12 8
15 14
What I did was
=QUERY(AnotherTable!1:1001; "SELECT * WHERE Row2 = 'FEB'")
But it didn't seems to work.
Any thoughts?
You might be able to use a FILTER formula instead:
=FILTER(AnotherTable!1:1001;AnotherTable!2:2="FEB")
or to return both months:
=FILTER(AnotherTable!1:1001,((AnotherTable!2:2="FEB")+(AnotherTable!2:2="APR")))
Use TRANSPOSE built-in function two times, the first to flip the source data, the second to flip the result, and instead of referencing rows, the formula should reference columns.
The resulting formula is
=TRANSPOSE(QUERY(TRANSPOSE(A:D),"Select * where Col1='FEB' OR Col1='APR'"))
Applying the above formula to the following source data
FEB MAR APR MAY
10 14 7 13
12 9 8 19
15 11 14 16
will return the following result
FEB APR
10 7
12 8
15 14

Resources