Search code examples
google-sheetschartsgoogle-visualizationlinechartgoogle-query-language

Google sheets - Line Chart


I am new to Google sheets and trying to create a timeline line chart. The data is as follows.

enter image description here

Col1 defines Project, Col2 defines the hours left for the projects, Col3 defines the start date and Col4 defines the End time of the Project.

I am trying to create a line chart where each line represents a Project with the value on y-axis as Hours left and on x Axis it shows Date. The line height (on y-axis) will be defined by Hours Left and the length of line (on x-axis) will be defined by start date and end date (as below).

enter image description here

I've tried different combinations, but not reaching a proper solution.

I can also try to change the formatting of data, if that is the issue.


Solution

  • the line chart is based on series so you need to reorganize your data like this:

    =QUERY(A2:D, "select D,max(B) where B is not null group by D pivot A")
    

    enter image description here