google chart script generates unexpected error

Tag: google-apps-script Author: xiaolaoxue Date: 2013-06-16

Everytime i try to load a chart from the data i have it says "unexpected error".

I've loaded data from a datasheet with 1480 rows. Adding it the chart by the google menu works flawlessly.

when i add it throught script, it fails with the following error: "Error encountered: An unexpected error ocurred"

function doGet() {

   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var sheet = ss.getSheets()[0];
   var lastrow = (sheet.getLastRow());
   // Get the range of cells that store mining data.
   var mining = ss.getRange("A2:H"+lastrow);

   // For every row of mining data, generate a mining object.
   var miningObjects = getRowsData(sheet, mining);

     var dataload = Charts.newDataTable();
     dataload.addColumn(Charts.ColumnType.STRING, "Date");
     dataload.addColumn(Charts.ColumnType.NUMBER, "Hash");
     for(var i = 0; i<miningObjects.length;i++){
       var support = miningObjects[i]
       //Browser.msgBox(Utilities.formatDate(, "GMT-4", "yyyy-MM-dd HH:mm")+"")
       dataload.addRow([Utilities.formatDate(, "GMT-3", "yyyy-MM-dd HH:mm")+"", support.hash])

     var lineChart = Charts.newLineChart()

        var control = Charts.newStringFilter()

     var dashboard = Charts.newDashboardPanel()
         .bind(control, lineChart)

     var uiApp = UiApp.createApplication();




original spreadsheet is here. for testing purposes i'm only using the first two rows.

Best Answer

Seems like there is a few things going on here. Not sure if you really want the control filter on a date. However, in the interest of just getting this working for you - you need to also add the filter control to the dashboard. See the .add(control) below.



this did it. worked perfectly :D