Thanks It's working....

On Thu, Feb 20, 2014 at 10:23 PM, asgallant <[email protected]>wrote:

> If you want to keep your custom tooltips, you have to add tooltip columns
> to your columns array:
>
> for (var i = 0; i < pausecontent.length; i++) {
>     columns.push({
>         type: 'number',
>         label: pausecontent[i],
>         calc: (function (x) {
>             return function (dt, row) {
>
>   return (dt.getValue(row, 0) == pausecontent[x]) ? dt.getValue(row, 1) : 
> null;
>             }
>         })(i)
>     });
>
>     columns.push({
>         type: 'string',
>         role: 'tooltip',
>         calc: (function (x) {
>             return function (dt, row) {
>
>   return (dt.getValue(row, 0) == pausecontent[x]) ? dt.getValue(row, 2) : 
> null;
>             }
>         })(i)
>     });
> }
>
> On Thursday, February 20, 2014 5:49:07 AM UTC-5, 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 a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/0Hrs1cuErhY/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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.
>

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