Hi all, 

New user here trying to make the switch to google scripts. I've come across 
a particular use case that I think would be very valuable and it involves a 
stacked area chart. I was able to create what I wanted in excel in 5 
minutes however 6 hours later in google script and I don't think I'm any 
closer to solving it.

I'm looking to create a graph that looks and functions like this but my 
current script won't display correctly as its my understanding that stacked 
area charts need multiple columns of data. But at that point I don't know 
how to implement the dashboard controls as it differs significantly from 
any of the tutorials I've been able to find. Additionally, as a wish list 
I'd like to include a date slider at the bottom of the graph to zoom and 
focus on certain sections of the graph but thats more likely a 2.0 feature 
for me. Any help you could provide me would be greatly appreciated.
<https://lh5.googleusercontent.com/-IFa7lFN6o-I/Udz_WqMidhI/AAAAAAAAAAM/yzrfiodqraM/s1600/Screen+Shot+2013-07-09+at+11.24.32+PM.png>







<https://lh4.googleusercontent.com/-taIlh2BofmA/Ud0ADdhdUnI/AAAAAAAAAAU/V-rH7JZtdl8/s1600/Screen+Shot+2013-07-09+at+11.23.22+PM.png>









My script is as follows.

function doGet() {
 var ss = SpreadsheetApp.openById('Hidden');
  
  var data = ss.getDataRange();
  
  var typeFilter = 
Charts.newCategoryFilter().setFilterColumnIndex(1).build();
  var stateFilter = 
Charts.newCategoryFilter().setFilterColumnIndex(2).build();
  
  var areaChart = Charts.newAreaChart()
  .setDataViewDefinition(Charts.newDataViewDefinition().setColumns([0,3]))
  .setXAxisTitle('Date')
  .setStacked()
  .build();

  var dashboard = Charts.newDashboardPanel().setDataTable(data)
  .bind([typeFilter,stateFilter], [areaChart])
  .build();

  var app = UiApp.createApplication();
  var filterPanel = app.createVerticalPanel();
  var chartPanel = app.createHorizontalPanel();
  filterPanel.add(typeFilter).add(stateFilter).setSpacing(5);
  chartPanel.add(areaChart);
  
  
  dashboard.add(app.createVerticalPanel().add(filterPanel).add(chartPanel));
  app.add(dashboard);
  
  return app;
  
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to