Google Charts Error: [object Object] does not fit the Control specification while handling 'ready' event.

533 views
Skip to first unread message

jim little

unread,
Dec 20, 2014, 3:41:17 PM12/20/14
to google-visua...@googlegroups.com
Hi I'm running into the following error when trying to execute dashboard with google charts:

[object Object] does not fit the Control specification while handling 'ready' event.

My code is as follows:

 

google.load('visualization', '1.0', {
  packages: ['controls','corechart']
});
 
google.setOnLoadCallback(function() {
  angular.bootstrap(document.body, ['fva']);
});
var drawHomeDashboard  = function() {
                    
                    var totalRows = $scope.projects.length;

                    var data = new google.visualization.DataTable();

                        data.addColumn({type:'date', label: 'Date', role:'domain'});
                        data.addColumn('number', 'Projects');

                        data.addRows(totalRows);


                        var homeData = [];                
                        var projectsCompleted = 0;

                            for(i=0; i<$scope.projects.length; i++){

                                var endDate = $scope.projects[i].DtEndProject;

                                if(endDate === null){

                                }else{

                                 var dateResult = new Date(endDate);
                                 var dateYear = dateResult.getFullYear();
                                 var dateMonth = dateResult.getMonth();
                                 var dateDay = dateResult.getDate();

                                 data.setCell(i,0, new Date(dateYear, dateMonth, dateDay) );
                                 data.setCell(i,1, 1);

                                };
                            }

                        var result = google.visualization.data.group(
                            data,
                            [{'column': 0, 'aggregation': google.visualization.data.date, 'type': 'date'}],
                            [{'column': 1, 'aggregation': google.visualization.data.sum, 'type': 'number'}]
                        );
         
                        var dashboard = new google.visualization.Dashboard(document.getElementById('home-dashboard'));

                        var view = new google.visualization.DataView(result);
                    
                        var ChartRangeFilter = new google.visualization.ControlWrapper({
                            'controlType': 'ChartRangeFilter',
                            'containerId': 'control-div',
                            'options': {
                                 'filterColumnIndex': 0,
                            },
                            'state': {'lowValue': 3, 'highValue': 6}
                        });

                        var AreaChart = new google.visualization.ControlWrapper({
                            'controlType': 'AreaChart',
                            'containerId': 'chart-div',
                            dataTable: data,
                            'options': {
                            
                            },
                            'view': {'columns': [0, 1]}
                        });
                    
                        

                        dashboard.bind(ChartRangeFilter, AreaChart);
                        dashboard.draw(view);
                    
            };
                drawHomeDashboard();

Other than the error messages flooding the page the chart and its bound control seems to work perfectly fine. They just get spammed off the page as soon as you start using the control. Any feedback will be much appreciated.

I should also note that i've tried this with the "DateRangeFilter" as well.


jim little

unread,
Dec 20, 2014, 4:01:11 PM12/20/14
to google-visua...@googlegroups.com
I feel pretty dumb I had "ControlWrapper" listed for both the chart and the control. turning the chart to "ChartWrapper" fixed this immediately.

Daniel LaLiberte

unread,
Dec 20, 2014, 4:28:17 PM12/20/14
to google-visua...@googlegroups.com

Hi Jim, 

Glad you got it working.  The error message is fairly misleading, though, so thanks for reporting your experience.

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages