Perfect, thank you for the help! -John
On Friday, November 16, 2012 7:20:01 AM UTC+13, asgallant wrote: > > First, you call google.load twice and google.setOnLoadCallback twice - cut > those down to one each. Second, you need to create the dashboard before > you set up the "ready" event handler that draws the gauges. Third, the > name of the dashboard variable has to be the same as what it used in the > event handler (you named the variable "chart" but referenced "dashboard" > for the event handler). Here's a working version: > http://jsfiddle.net/asgallant/psvpp/ > > On Thursday, November 15, 2012 3:21:09 AM UTC-5, John Rudolph wrote: >> >> Thanks for the quick response. The problem is that the 2 gauges are not >> showing up, although the geoMap and filters seem to work. Here is the >> dashboard with code for the gauges included: >> http://www.aml360.com/testDashboard.html. The gauges are supposed to >> show up in the gray column on the left, stacked on top of each other. >> Ideally the gauges will show averages for entire dataset, and then update >> when either a filter is applied, or a region on the geoMap is clicked. >> >> Again, greatly appreciate all the help! >> >> -John >> >> On Thursday, November 15, 2012 5:30:00 PM UTC+13, asgallant wrote: >>> >>> What is the problem you are seeing? Skimming that code, it looks like >>> you should get two gauges with values equal to the average of column 0 and >>> column 2. The only oddity that I see off the bat is the column 2 average >>> is getting labeled with the column 1 label. >>> >>> On Wednesday, November 14, 2012 9:37:25 PM UTC-5, John Rudolph wrote: >>>> >>>> Still pretty new to visualizations. I have created this geochart with a >>>> couple of category filters: http://www.aml360.com/testDashboard.html. >>>> I am trying to add a couple of gauges based on columns 0 and 2 in the >>>> imbedded table. Tried to do the best I could by looking at some prior >>>> forum >>>> posts, but still don't quite have the savy to make it work for my data. >>>> Below is as far as I made it with the gauges. Where did I slip up? Thanks >>>> in advance for the help. I'm always blown away by the great responses on >>>> this forum. >>>> >>>> // set up a dataTable for the gauges >>>> var gaugeData = new google.visualization.DataTable(); >>>> gaugeData.addColumn('string', 'Series'); >>>> gaugeData.addColumn('number', 'Average'); >>>> >>>> gauges = new google.visualization.ChartWrapper({ >>>> chartType: 'Gauge', >>>> dataTable: gaugeData, >>>> containerId: 'gauges', >>>> options: { >>>> redFrom: 100, >>>> redTo: 150, >>>> yellowFrom: 50, >>>> yellowTo: 100, >>>> minorTicks: 25 >>>> } >>>> }); >>>> >>>> google.visualization.events.addListener(gauges, 'ready', onReady); >>>> >>>> function onReady() { >>>> } >>>> >>>> // set up event listener to draw the gauge when the dashboard is >>>> done >>>> google.visualization.events.addListener(dashboard, 'ready', >>>> function (e) { >>>> var view = geoChart.getDataTable(); >>>> var group = google.visualization.data.group(view, [{ >>>> column: 1, >>>> type: 'string', >>>> modifier: function () { >>>> // make them all the same for grouping >>>> return 0; >>>> } >>>> }], [{ >>>> column: 0, >>>> type: 'number', >>>> label: view.getColumnLabel(0), >>>> aggregation: google.visualization.data.avg >>>> }, { >>>> column: 2, >>>> type: 'number', >>>> label: view.getColumnLabel(1), >>>> aggregation: google.visualization.data.avg >>>> }]); >>>> >>>> // clear the gaugeData table >>>> if (gaugeData.getNumberOfRows() > 0) { >>>> gaugeData.removeRows(0, gaugeData.getNumberOfRows()); >>>> } >>>> // populate the gaugeData table >>>> for (var i = 1; i < group.getNumberOfColumns(); i++) { >>>> gaugeData.addRow([group.getColumnLabel(i), >>>> group.getValue(0, i)]); >>>> } >>>> gauges.draw(); >>>> }); >>>> >>> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/knbvn_hmCJUJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
