使面板的宽度更大javascript

时间:2014-01-19 13:20:57

标签: javascript google-apps-script

我有一个小宽度的面板。我尝试扩展它,但然后应用程序崩溃。这是我的代码:

var pieChart = Charts.newPieChart()
  .setDataViewDefinition(Charts.newDataViewDefinition().setColumns([0,3]))
  .build();

  var tableChart = Charts.newTableChart()
  .setDataViewDefinition(Charts.newDataViewDefinition().setColumns([0,1,2,3,4,5,6]))
  .build();

  var dashboard = Charts.newDashboardPanel().setDataTable(data)
  .bind([filterSalesTotal, filterName, filterSalesType], [tableChart, pieChart])
  .build();


  var app = UiApp.createApplication();
  var filterPanel = app.createVerticalPanel();
  var chartPanel = app.createHorizontalPanel();
  filterPanel.add(filterName).add(filterSalesType).add(filterSalesTotal).setSpacing(12);
  chartPanel.add(pieChart).add(tableChart).setSpacing(12);

  dashboard.add(app.createVerticalPanel().add(filterPanel).add(tableChart).add(chartPanel));
  app.add(dashboard);
  return app;


}

我尝试输入此内容但是应用程序崩溃了:

dashboard.add(app.createVerticalPanel.setWidth(400).add(filterPanel).add(tableChart).add(chartPanel));
  app.add(dashboard);
  return app;

我收到以下错误:

TypeError:在对象函数中找不到函数setWidth createvVerticalPanel(){/ ** /}.

1 个答案:

答案 0 :(得分:0)

似乎你只是忘了一对括号......而且参数应该是一个字符串,如自动完成中所示(控件+空格键入时)。

enter image description here

  dashboard.add(app.createVerticalPanel().setWidth('400').add(filterPanel).add(tableChart).add(chartPanel));
  app.add(dashboard);
  return app;