2013-03-29 171 views

回答

0

目前在Google Visualization API中沒有辦法做到這一點。

你可以嘗試HTML Tooltips,看看你是否可以找出CSS讓它們正常顯示(這可能是)。

另外,你也可以編寫自己的Javascript來顯示任何你想要的任何地方。不幸的是,我還沒有看到這個例子。如果您找到解決方案,請在此分享並將其標記爲答案!

1
var svg = document.getElementById('div_id').getElementsByTagName('svg')[0];  
var parent = svg.childNodes[4].firstChild.nextSibling.firstChild.nextSibling.firstChild.parentNode; 
for(var i=0; i<svg.childNodes[4].childNodes[1].childNodes[1].childElementCount; i++) { 
    var g = document.createElementNS('http://www.w3.org/2000/svg', 'g'); 
    var text = document.createElementNS('http://www.w3.org/2000/svg', 'text'); 
    var child = svg.childNodes[4].firstChild.nextSibling.firstChild.nextSibling.firstChild; 
    text.setAttribute('x', child.getAttribute('x')); 
    text.setAttribute('y', child.getAttribute('y')); 
    text.setAttribute('fill', '#000000'); 
    text.setAttribute('dy', '-2');  
    text.textContent = 'Hell0'; 
    parent.removeChild(child); 
    g.appendChild(child); 
    g.appendChild(text); 
    parent.appendChild(g); 
} 

我寫了上面的javascript代碼,將文本'Hell0'追加到每列的頂部。

這種方法的缺點是工具提示&交互性不起作用。所以你需要關閉如下

tooltip: {tigger: 'none'}, 
enableInteractivity: false,