[visualization-api] Re: New to google charts having " Uncaught TypeError: Object # has no method 'ug' " Error

Thu, 27 Feb 2014 07:07:19 -0800

There are two things you need to fix.  First, you need to use the "new" 
keyword when calling the DataTable constructor:

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

Then, since you are using a Table visualization, you need to load the 
"table" package:

google.load('visualization', '1.0', {
    'packages': ['table'],
    'callback': drawChart
});

You can load multiple packages if you plan to use tables and charts 
together:

google.load('visualization', '1.0', {
    'packages': ['corechart', 'table'],
    'callback': drawChart
});

On Wednesday, February 26, 2014 11:39:15 PM UTC-5, Tanzeelurrehman Qureshi 
wrote:
>
> Hi Every One
>
> I am new to google charts, I want to populate Google Charts with the 
> folllwoing code
>
> <script type="text/javascript" src="//
> ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
>   <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>     <script type="text/javascript">
>
>         function drawChart() {
>             var data = google.visualization.DataTable(
>                 { cols: [{ "id": "A", "label": "set A", "type": "string" 
> }, { "id": "B", "label": "set B", "type": "string" }, { "id": "C", "label": 
> "set C", "type": "Number" }], rows: [{ c: [{ v: "1"  }, { v: "1"  }, { v: 1 
>  }] }, { c: [{ v: "10"  }, { v: "10",  }, { v: 10  }] }, { c: [{ v: "20" 
>  }, { v: "20"  }, { v: 20  }] }], p: {} }
>                );
>
>             var options = {
>                 backgroundColor: { stroke: '#000', strokeWidth: 4, fill: 
> '#bbb' },
>                 title: 'Most Popular Pies',
>                 titleTextStyle: { fontSize: 18 },
>                 tooltip: { showColorCode: true },
>                 sliceVisibilityThreshold: .10,
>                 pieResidueSliceColor: '#109618',
>                 pieResidueSliceLabel: 'Everything else',
>                 is3D: true
>             };
>
>             var table = new 
> google.visualization.Table(document.getElementById('ChartArea1'));
>             table.draw(data, { showRowNumber: true });
>
>             //var chart = new 
> google.visualization.PieChart(document.getElementById('ChartArea1'));
>             //chart.draw(data, options);
>
>         }
>
>         google.load('visualization', '1.0', {
>             'packages': ['corechart'],
>             'callback': drawChart
>         });
>
>     </script>
>
>
> But it gives error in the console of browser as
>
> Uncaught TypeError: Object #<Object> has no method 'ug' 
>
> Please help me out regarding this. If possible provide me such a link 
> which has concise information about *arrayToDataTable and DataTable*
>

-- 
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