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/-/MZ9iEesNISUJ.
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.

Reply via email to