Skip to content

Instantly share code, notes, and snippets.

@so-c
Created June 23, 2013 08:23
Show Gist options
  • Save so-c/5844283 to your computer and use it in GitHub Desktop.
Save so-c/5844283 to your computer and use it in GitHub Desktop.
Google DocsのSpreadSheetにエクスポートしたSimpleDietのデータから折れ線グラフを作るための、Container-Bound Script。
/**
* Make a line chart with the data exported from iOS App SimppleDiet to Google Docs Spreadsheet.
*/
function addLineGraph() {
var sheets = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sheets.getSheets()[0];
var allRange = sheet.getDataRange();
var range = sheet.getRange(1, 1, allRange.getLastRow(), 2);
var chart = sheet.newChart().asLineChart()
.addRange(range)
.setPosition(1, 1, 0, 0)
.setOption('legend', {position: 'none'})
.setOption('chartArea', {width: 408, height: 306})
.build();
sheet.insertChart(chart)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment