You are misunderstanding the problem. Run the code snippet below.
The html formatting applied to the datatable appears in the tooltips
for the PieChart. The PieChart does not have an allowHtml option
(it's not documented, and I tried it anyway and it didn't work). This
is a problem.
In my case, I am visualizing the data both in a Table and in a
PieChart. I want to use formatting in the Table, but then the html
code appears in the PieChart's tooltips. To work around this, I need
to clone the table before formatting it, which wastes memory.
Can you please take a closer look at this? This seems like a bug to
me. In fact, the whole idea of applying the formatter to the
datatable and not to the dataview doesn't make sense to me.
In any case, please run the snippet below and let me know what you
think.
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Work');
data.setValue(0, 1, 11);
data.setValue(1, 0, 'Eat');
data.setValue(1, 1, 2);
data.setValue(2, 0, 'Commute');
data.setValue(2, 1, 2);
data.setValue(3, 0, 'Watch TV');
data.setValue(3, 1, 2);
data.setValue(4, 0, 'Sleep');
data.setValue(4, 1, 7);
var formatter = new google.visualization.TableBarFormat({width:
120});
formatter.format(data, 1); // Apply formatter to second column
// Create and draw the visualization.
new
google.visualization.PieChart(document.getElementById('visualization')).
draw(data, {title:"So, how was your day?"});