1 does indeed appear to be a bug.
2 is because you are specifying the calculated column's properties
incorrectly. The object key should be "properties" not "p":
cols.push({
calc: createTooltip(i),
type: "string",
role: "tooltip",
properties: {html: true}
});
Tooltip actions are incompatible with HTML tooltips, however, you can
recreate them in the HTML itself.
3, you need to specify the tooltip.trigger option to either be "selection"
or "both", and then click on the bars to select a data point. The tooltip
will stay in place when you mouse away from the bar, so you can click on
things in the tooltip.
Showing/hiding series by clicking on the legend is not supported by the
API; you have to use something like the hack that I wrote to accomplish it.
Yes, it is ugly, but it works.
There is no single standard for formatting numbers in any given locale
(beyond what characters to use for grouping and what to use for the decimal
separator), so the API defaults to no formatting. "#,###.##" might be
common in English-speaking locales, but it is no more standard than
"####.##" is. You don't have to handle the formatting in javascript,
though; you can handle it server-side and pass the formatted values
along-side the base values when constructing the DataTable:
var data = [
['API Category', 'Social', 'Music', 'File Sharing', 'Storage',
'Weather'],
['2011', {v: 9000, f: '9,000'}, {v: 5300, f: '5,300'}, {v: 1200, f:
'1,200'}, {v: 1600, f: '1,600'}, {v: 6000, f: '6,000'} ],
['2012', {v: 1005, f: '1,005'}, {v: 3400, f: '3,400'}, {v: 2600, f:
'2,600'}, {v: 3600, f: '3,600'}, {v: 4009, f: '4,009'} ],
['2013', {v: 6009, f: '6,009'}, {v: 2700, f: '2,700'}, {v: 2200, f:
'2,200'}, {v: 1000, f: '1,000'}, {v: 1500, f: '1,500'} ]
];
then you don't need to use a formatter at all. Incidentally, when you have
formatted data, you don't need to call the formatter again to get the
formatted value, you can just ask for it from the DataTable:
function createTooltip(col){
return function(dataTable, row){
var html = "<div></div>"; // this will create an empty div at the
start of your tooltip - is that what you want?
html += aggregates[0] + ": " + dataTable.getColumnLabel(col) + "\n";
html += aggregates[1] + ": " + dataTable.getValue(row, 0) + "\n";
html += metrics[0] + ": " + dataTable.getFormattedValue(row, col) +
"\n"; // don't need to use a formatter here
return html;
};
}
On Tuesday, September 2, 2014 10:19:07 AM UTC-4, Nicolas Fortin wrote:
>
> The issue 1 seems to be due to annotations. When I disabled them, all
> custom tooltips are rendered.
>
--
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/d/optout.