You can find out what states have data by calling 
dataTable.getDistinctValues(0).

If you don't have a column that specifies your tooltips, how would you like 
to create the tooltip contents?  The DataView can create the text contents 
for you, if you want.  As an example, if you wanted all of your tooltips to 
read "Total Count" (like in your example), you could do this:

columns.push({
    type: 'string',
    role: 'tooltip',
    calc: (function (x) {
        return function (dt, row) {
            return (dt.getValue(row, 0) == pausecontent[x]) ? 'Total Count'
 : null;
        }
    })(i)
});

On Friday, February 21, 2014 7:33:37 AM UTC-5, Ravindra Gharge wrote:
>
> For above example,
>
> if object have 0 count for some of the states then i want to skip this 
> states from the chart object.
> because it waste the unnecessary space in the chart and legend
>
> and
>
> Is their any way of setting the custom tooltip for given chart without 
> modifying the given object (in my example - without specifying null column 
> as tooltip) because doing this doing this object size increases...
>
>
>  
>
>
>
> On Thursday, February 20, 2014 4:19:07 PM UTC+5:30, Ravindra Gharge wrote:
>>
>> I want my legend in my column chart and want to customize the tooltip on 
>> hovering the chart column 
>>
>> following is my code : 
>> if i remove my legend part it will work but i want to keep my legend in 
>> my chart 
>> \google.setOnLoadCallback(drawChart);
>>
>> function drawChart() {
>>   var dataTable = google.visualization.arrayToDataTable([
>> ['state' , 'count', 'null'],
>> ['', 16,'Total Count'],
>> ['Assam', 4,'Total Count'],
>> ['Chhattisgarh', 1,'Total Count'],
>> ['Maharashtra', 245,'Total Count'],
>> ['Meghalaya', 17,'Total Count'],
>> ['Odisha', 13,'Total Count'],
>> ['Undefined', 2,'Total Count'],
>> ['West Bengal', 11,'Total Count'] ]);
>>  
>>   // A column for custom tooltip content
>>   //dataTable.addColumn({type: 'string', role: 'tooltip'});
>>
>>   var pausecontent = ["West Bengal", "Undefined", "Odisha", "Meghalaya", 
>> "Maharashtra", "Chhattisgarh", "Assam", ""];
>>     /****************************************************************/
>>     // set the columns to use in the chart's view (columns object is 
>> used in the view)
>>     // calculated columns put data belonging to each country in the 
>> proper column
>>     var columns = [0];
>>     for (var i = 0; i < pausecontent.length; i++) {
>>         columns.push({
>>             type: 'number',
>>             label: pausecontent[i],
>>             calc: (function (x) {
>>                 return function (dt, row) {
>>                    //return (row == pausecontent[x]) ? dt.getValue(row, 
>> 1) : null;
>>                     return (dt.getValue(row, 0) == pausecontent[x]) ? dt.
>> getValue(row, 1) : null;
>>                 }
>>             })(i)
>>         });
>>     }
>>   
>>   dataTable.setColumnProperty(2, 'role', 'tooltip');
>>   //var options = { legend: 'none', };
>>   //var chart = new 
>> google.visualization.ColumnChart(document.getElementById('visualization'));
>>            var chart = new google.visualization.ChartWrapper({
>>         chartType: 'ColumnChart',
>>         containerId: 'visualization',
>>         dataTable: dataTable,
>>         options: {
>>           // setting the "isStacked" option to true fixes the spacing 
>> problem
>>           'title': 'State Wise Coverage Performance',
>>           'isStacked': true,
>>           'height': 300,
>>           'width': 800,
>>           bar: {groupWidth: '90%'},
>>       
>>         },
>>         view: {
>>             columns: columns
>>         }
>>     });
>>           
>>           
>>   chart.draw();
>> }
>>
>> Please help ,
>> *Thanks in advance *
>>
>>

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