Search code examples
google-sheetschartsline

Google Sheets Line Chart: connect missing points


How do I connect missing points in a Google Sheets Line Chart with a straight line? https://docs.google.com/spreadsheets/d/1X3BhDyideX-7kyJ9Y-7xvV1naAwWd9eDPfPy3pP94Ic/edit?usp=sharing

Thank you.


Solution

  • In your situation, how about checking "Plot null values"? When this is checked, the following result can be obtained.

    enter image description here

    When you want to check it using Google Apps Script, you can also use the following script.

    function myFunction() {
      const sheet = SpreadsheetApp.getActiveSheet();
      const chart = sheet.getCharts()[0];
      const c = chart.modify().setOption("interpolateNulls", "true").build();
      sheet.updateChart(c);
    }
    

    Reference: