1

I need (want) to create a Google Sheets Area Graph (Chart).

The Graph/Chart will represent "Date"s. I need the Xaxis to be the dates (as days) between these start and end dates: 01/27/2020, 4/25/2020 (these dates are in separate Cells of the same row in my Sheet.)

I don't want to create by hand 90 rows of days/dates between 01/27/2020 and 4/25/2020 to use as the Xaxis.
I want a "for" loop to create those 90 dates, then the Area Graph/Chart to use the result as the Xaxis.

The Yaxis will be a value like '10', and the same '10' for each date, and a color like 'brown' or 'yellow'. In the end, the chart will be a 'brown' box, 90 units wide Xaxis, 10 tall Yaxis, with the 90 day dates as the Xaxis legend.

It is possible that I will then use the concept to also create several contiguous Areas adding up to the same end point. For example: The main brown box, 90 days wide, then a shorter (not as tall as '10') yellow or blue box starting at 03/04/2020 and ending at 03/31/2020. etc.

Since "Area" is the same concept as "Line" except with the color fill to the baseline, I'm thinking "Area" for no other reason but appearance.

I do not know where and how to correctly put such a "for loop". Some references I have read are so old that Google Sheets no longer has such Options.

Do I create the 90 days dates with a for loop in a new Cell in that row as the start/end dates, and '10' as the Yaxis value is another new Cell? Then Insert the Chart based on those 2 Cells??

I have attempted to do this with PHP and JpGraph, and have been moderately successful, but Google Sheets is the data source, and it seems to me I should keep things in one drawer.

I am anxious for pointers to focus on Sheets/Java functions, and where they need to be placed! I have done a few things with Sheets. but I have done extensive Google Maps with javascript "for loops" that I have copy/paste'd/edited from code snippets, etc, but in a PHP page. Time to learn new things - even though these things have been around 15 years!

Something similar that I did in PHP/JpGraph: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.