Can you post the current version of the code you are using, along with a 
sample queryObject I can use to test this?

On Tuesday, August 5, 2014 1:46:15 PM UTC-4, saKw wrote:
>
> Hi Andrew,
>  
> When I remove the PieChart from the Dashboard.bind call, i dont see pie 
> chart image in my page. and also i get an error that says "
> Invalid column index 2. Should be an integer in the range [0-1].
> "
> Thanks
>
> On Friday, August 1, 2014 8:38:08 PM UTC-4, Andrew Gallant wrote:
>
> You need to calculate the data for your PieChart in the "ready" event 
> handler for your Table:
>
> google.visualization.events.addListener(table, 'ready', function () {
>     var newData = table.getDataTable();
>     var group = google.visualization.data.group(newData, [1] [{
>         // we need a key column to group on, but since we want all rows 
> grouped into 1,
>         // then it needs a constant value
>         column: 2,
>         aggregation: google.visualization.data.sum,
>         type: 'number',
>         modifier: function () {
>             return 1;
>         }
>     }]);
>     document.getElementById('avg').innerHTML = group.getValue(0, 1);
>
>     var pieData = google.visualization.data.group(newData, [1], [{
>         column:2,
>         aggregation: google.visualization.data.sum,
>         type:'number'
>     }]);
>     pie.setDataTable(pieData);
>     pie.draw();
> });
>
> and you need to remove the PieChart from the Dashboard.bind call:
>
> var chart = new 
> google.visualization.Dashboard(document.getElementById('dashboard')). 
> bind([categoryPicker], [table]);
>
> On Friday, August 1, 2014 2:00:19 PM UTC-4, saKw wrote:
>
>
> <https://lh3.googleusercontent.com/-zXeubBSjnX8/U9vVm9YA9TI/AAAAAAAAIgU/RTFR1mbrvh4/s1600/Capture.PNG>
>
>  
>
> Hi Andrew,
>  
> Thanks for your reply.
>  
>  
> I tried doing as per your suggestion but not getting the expected result. 
> I am still getting TYPES repeated for default category picker (in my code 
> it is All MDNs). I want it to be sum of MINUse group by TYPES.
>  
> I am posting my javascript, can you pls take a look and let me know where 
> I am doing wrong?
>  
> In my table *PIN *->mdn, TYPES->category and *MINUse->kbUsage.*
>  
> I have attached my pie chart pic. As you can see in the legend the 'Email 
> & messaging' coming multiple times so is the 'Unknown'.
>
>
> <https://lh3.googleusercontent.com/-zXeubBSjnX8/U9vVm9YA9TI/AAAAAAAAIgU/RTFR1mbrvh4/s1600/Capture.PNG>
>  
>  
>  
>
> function drawChart() {
>
>                            var data = new 
> google.visualization.DataTable();
>
>                            
>
>                            data.addColumn('string', 'mdn');
>
>                 data.addColumn('string', 'category');
>
>                 data.addColumn('number', 'kbUsage');
>
>                            
>
>                            //alert("inside drawChart");
>
>                 for(var i=0;i<queryObjectLen;i++)
>
>                 {                               
>
>                     var category = queryObject.empdetails[i].category;
>
>                                   //alert(category);
>
>                     var kbUsage = queryObject.empdetails[i].kbUsage;
>
>                                   //alert(kbUsage);
>
>                                   var mdn = queryObject.empdetails[i].mdn;
>
>                                   //alert(mdn);                            
>
>
>                     data.addRows([
>
>                         [mdn,category,parseInt(kbUsage)]
>
>                     ]);
>
>                 }
>
>                 var options = {
>
>                     title: 'Category Information',
>
>                                   legend: {position: 'right', textStyle: 
> {color: 'black', fontSize: 9}},
>
>                                   is3D: true,
>
>                                   pieSliceText: 'percentage',
>
>                                   sliceVisibilityThreshold:0,
>
>                                   vAxis: {maxValue: 70},
>
>                                   chartArea: {height: '85%', top: '13%'},
>
>                                   tooltip: { text: 'percentage'},
>
>                                   left:30,top:20,width:"100%",height:
> "100%"
>
>                                   /*backgroundColor: {
>
>                                                 stroke: 'gray',
>
>                                                 strokeWidth: 1
>
>                                          }*/
>
>                 };                       
>
>                            var total = 0;
>
>                            for (var i = 0; i < data.getNumberOfRows(); 
> i++) {
>
>                                   total += data.getValue(i, 2);
>
>                            }
>
>                            //alert(total);
>
>                             var legend = document.getElementById("legend"
> );
>
>                            var legItem = [];
>
>                            var colors = ['#e0440e', '#e6693e', '#ec8f6e', 
> '#f3b49f', '#f6c7b6', '#f3aaaa', '#f6cccc'];
>
>                            for (var i = 0; i < data.getNumberOfRows(); 
> i++) {
>
>                                   var label = data.getValue(i, 1);            
>                   
>
>
>                                   var value = data.getValue(i, 2);
>
>                                   //alert(value);            
>
>                                   var percent = Number(100 * value / 
> total).toFixed(2);
>
>                                   data.setFormattedValue(i, 1, label + ' 
> (' + percent + '%)');                              
>
>                            }
>
>                            
>
>                            var categoryPicker = new 
> google.visualization.ControlWrapper({
>
>                            controlType: 'CategoryFilter',
>
>                            containerId: 'control3',
>
>                            options: {
>
>                                   filterColumnLabel: 'mdn',
>
>                                   ui: {
>
>                                          labelStacking: 'vertical',
>
>                                          allowTyping: false,
>
>                                          allowMultiple: false,
>
>                                          caption : 'All MDNs'
>
>                                   }
>
>                            }
>
>                        });
>
>                        
>
>                        // Define a table
>
>                            var table = new 
> google.visualization.ChartWrapper({
>
>                                   chartType: 'Table',
>
>                       &nbs
>
> ...

-- 
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-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@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 via email to