Hi Doug, Since you are using AppsScript to display charts, you may have to consult with their documentation first. The Google Charts documentation won't give you quite enough details since it assumes you are working in a normal web page. Perhaps this is where you should start: https://developers.google.com/apps-script/reference/charts/dashboard-panel
On Tue, Dec 20, 2016 at 1:22 AM, Dat Viz <[email protected]> wrote: > > > On Monday, December 19, 2016 at 10:16:56 PM UTC-8, Dat Viz wrote: >> >> I am a fairly new Apps Script Programmer, so I apologize in >> advance for any questions that might seem obvious to advanced users. I >> looked here >> <https://developers.google.com/chart/interactive/docs/gallery/controls#preparedata> >> to >> learn how to build a dashboard for a Google Sheet. I was able to use some >> apps script that I tested in the Script Editor to crate an array. I seemed >> to follow most of the HTML conventions suggested thus far, but when I got >> to Step 5 I noticed that the options one could specify when setting up >> either a ControlWrapper or ChartWrapper. I clicked on the links specified >> there, but the ControlWrapper >> <https://developers.google.com/chart/interactive/docs/gallery/controls#controlwrapperobjectrtwrapperobject> >> page, >> and the ChartWrapper >> <https://developers.google.com/chart/interactive/docs/reference#chartwrapperobject>page >> didn't really go into the properties; they described the methods that could >> be called. I don't know why Google wouldn't report these, but I am finding >> they leave a lot of information out for you to just figure out on your own. >> Perhaps there is an assumption that one has done some web programming, but >> I haven't so again please excuse any ignorance on my part. Does anyone know >> where I can find a list of the options that can be set for these two >> classes? >> Also, I really didn't see anywhere on the page that showed you >> how to test whether the separate HTML file had worked. I would assume if I >> am making this as an added dashboard to a Google sheet, I would go to >> Publish →Deploy as Sheets web add on, but I wasn't sure. Lastly, in the >> example, they give hand typed/programmed arrays in there, while I used a >> script to populate an array. I was wondering if I would need to push >> categorization for all columns to the top of the array? I can share the >> script I added if this is helpful. I am just a little confused by this >> write up, as it doesn't really "fill in all of the blanks". Thanks for any >> help! >> > > I probably should add what I have thus far: > <!DOCTYPE html> > <html> > <head> > <!--This is what you will need to do every time you create a data > visualization dashboard chart--> > <script type="text/javascript" src="https://www.gstatic.com/ > charts/loader.js"> > <script type="text/javascript" > // Load the Visualization API and the controls package. > // Packages for all the other charts you need will be loaded > // automatically by the system. > google.charts.load("current", {'packages' :['corecharts'],['controls' > ]});. > // Set a callback to run when the Google Visualization API is loaded. > google.charts.setOnLoadCallback(drawDashboard); > function DrawDashboard(){ > //here is where you add the apps to get what you need. > //You need to figure out how to call your spreadsheet from here. > var ss = SpreadsheetApp.getActive(); > var s = ss.getSheetByName("Stats"); > //Not sure we need a comma separator > var datSet = [,]; > //Here we would convert the array to a datatable > var ss = SpreadsheetApp.getActive(); > var sheets = ss.getSheets(); > var s = sheets[1]; > var UI = SpreadsheetApp.getUi(); > var response = UI.prompt("Please enter the first cell in the > category").getResponseText(); > var ir = s.getRange(response); > var n= 0; > var stored = []; > > //Here is where you create your dashboard. > var dashboard = new google.visualization.Dashboard(document. > getElementById('growing-dash')); > > > //Now you just need to figure out how to do this for a 2D array....we > can use this as our script > > while (ir.getValue()!= "") { > n = n +1; > ir = ir.offset(1, 0); > } > ir = ir.offset(-n,0) > > for(i =0; i<n;i++) { > stored.push([ir.getValue(),ir.offset(n+2,0).getValue()]); > ir = ir.offset(1, 0); > } > var data = google.visualization.AarrayToDataTable(stored[]); > > //creating the datachart > > var Pie = new google.visualization.ChartWrapper({ > 'controltype' : 'PieChart', > 'container_Id' : 'chart_div', > 'options' : { > 'width' : 350, > 'height' : 325, > 'title' : 'Count by salary' > } > > } > </script> > > <base target="_top"> > </head> > <body> > <!--This is what is going to hold the dashboard--> > <div id="growing-dash"> > <!--We need div deviders that separate each control and chart--> > <div id="filter1"> </div> > <div id="chart1"> </div> > </div> </body> > > -- > 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 google-visualization-api@ > googlegroups.com. > Visit this group at https://groups.google.com/ > group/google-visualization-api. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-visualization-api/1241cb09-f148-4346-9c48- > 35109e39137e%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/1241cb09-f148-4346-9c48-35109e39137e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> 5CC, Cambridge MA -- 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 https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPhbbd6z_wb%2BNKp_jmf98iphFFuQckNomqQeQiZuQbbiQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
