title: Google sheets graphs show perfectly on the screen, but does not print all the graphs (Random which get printed)
body: <p>I have created a google sheet that create a flightplan. After all the numbers are inserted to the sheet,I create between 5 and 9 graphs. (1 &quot;linechart&quot; and 4-8 &quot;scattercharts&quot;).
  It works fine, and the graphs are build and looks perfect, but when I try to print the sheet (incl the charts), some of the charts are not printed.
  It is random which charts are not printed and even the number of charts that are not printed are different from each time I run the code.
  The linechart are build by its own code and prints everytime.
  The scattercharts are all printed in a function that runs once for each graph that should be created.
  If I build the charts manually it prints all charts, but doing, what to me look like the same thing, with javascript, it does not print all the graphs.</p>
  <p>This funtion create the &quot;Linechart&quot;:</p>
  <pre><code>function createEnvelope() {
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getRange('S25').activate();
    spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Flyveplan'), true);
    var sheet = spreadsheet.getActiveSheet();
    
    charts = sheet.getCharts();
    for (i = 0; i &lt; charts.length; i++) {
      chart = charts[i];
      sheet.removeChart(chart);
    }
   
    chart = sheet.newChart()
    .asLineChart()
    .addRange(spreadsheet.getRange('Data!A9:E10'))
    .setMergeStrategy(Charts.ChartMergeStrategy.MERGE_ROWS)
    .setTransposeRowsAndColumns(true)
    .setNumHeaders(-1)
    .setHiddenDimensionStrategy(Charts.ChartHiddenDimensionStrategy.IGNORE_BOTH)
    .setOption('bubble.stroke', '#000000')
    .setOption('hAxis.textStyle.color', '#ffffff')
    .setOption('useFirstColumnAsDomain', true)
    .setOption('hAxis.viewWindow.max', -2500)
    .setOption('hAxis.viewWindow.min', -23000)
    .setOption('hAxis.viewWindowMode', 'explicit')
    .setOption('vAxes.0.viewWindow.max', 3000)
    .setOption('vAxes.0.viewWindow.min', 2000)
    .setOption('vAxes.0.viewWindowMode', 'explicit')
    .setPosition(24, 4, 13, 3)
  //  .setOption('height', 328)
    .build();
    sheet.insertChart(chart);
  //  insertCGValues('Flyveplan!V35', 'Flyveplan!X39', 'Flyveplan!V23', '#ff0000')
  };
  </code></pre>
  <p>This function creates a number of Scattercharts (Which are the once that does not show on the print:</p>
  <pre><code>function insertCGValues(r1, r2, color){
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getRange('S25').activate();
    var sheet = spreadsheet.getActiveSheet();
    chart = sheet.newChart()
    .asScatterChart()
  //  .addRange(spreadsheet.getRange('Flyveplan!V35'))
  //  .addRange(spreadsheet.getRange('Flyveplan!X39'))
  //  .addRange(spreadsheet.getRange('Flyveplan!V23'))
    .addRange(spreadsheet.getRange(r1))
    .addRange(spreadsheet.getRange('Flyveplan!S39'))
    .addRange(spreadsheet.getRange(r2))
    .setMergeStrategy(Charts.ChartMergeStrategy.MERGE_COLUMNS)
    .setTransposeRowsAndColumns(false)
    .setNumHeaders(0)
    .setHiddenDimensionStrategy(Charts.ChartHiddenDimensionStrategy.IGNORE_BOTH)
    .setBackgroundColor('transparent')
    .setOption('useFirstColumnAsDomain', true)
    .setOption('curveType', 'none')
    .setOption('domainAxis.direction', 1)
    .setOption('treatLabelsAsText', false)
    .setOption('hAxis.viewWindow.max', 100)
    .setOption('hAxis.viewWindow.min', 0)
    .setOption('hAxis.viewWindowMode', 'explicit')
    .setOption('vAxes.0.viewWindow.max', 3000)
    .setOption('vAxes.0.viewWindow.min', 2000)
    .setOption('vAxes.0.viewWindowMode', 'explicit')
    .setOption('series.0.color', color)
    .setOption('series.0.pointSize', 7)
    .setPosition(24, 4, 13, 3)
  //  .setOption('height', 328)
    .build();
    sheet.insertChart(chart);
  };
  </code></pre>
  <p>Please let me know if you need any more information. This is my first question here, so please let me know if there is something missing.</p>
  <p>When I run the function &quot;testInsertCGValues()&quot;, the graphs are build and visible on the screen. The problem shows when I try to print the page via the &quot;print&quot; button in Google Sheets, or simply press &quot;CTRL+P&quot;</p>
  <p>Link to the sheet:
  <a href="https://docs.google.com/spreadsheets/d/1uc6QFCNjH9SGe52phFbsp_hVwQ-N7nvU5yB6EsK3bUQ/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1uc6QFCNjH9SGe52phFbsp_hVwQ-N7nvU5yB6EsK3bUQ/edit?usp=sharing</a></p>