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.