Javascript 带有饼图的谷歌图表工具提示不是';t显示

Javascript 带有饼图的谷歌图表工具提示不是';t显示,javascript,charts,pie-chart,Javascript,Charts,Pie Chart,我正在使用谷歌图表绘制饼图。我需要更改slice offset值slice onhover事件。我写了一些代码,但问题是图表不显示工具提示 // Load the Visualization API and the piechart package. google.load('visualization', '1.0', { 'packages': ['corechart'] }); // Set a callback to run when the Google Visualization

我正在使用谷歌图表绘制饼图。我需要更改slice offset值slice onhover事件。我写了一些代码,但问题是图表不显示工具提示

// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', { 'packages': ['corechart'] });

// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);

// Callback that creates and populates a data table, 
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {

    // Create the data table.
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Topping');
    data.addColumn('number', 'Slices');
    data.addRows([
      ['Mushrooms', 3],
      ['Onions', 1],
      ['Olives', 1],
      ['Zucchini', 1],
      ['Pepperoni', 2]
    ]);

    var options = {
        is3D: true,
        tooltip: { textStyle: { color: '#000000' }, showColorCode: true }

    };
    // Instantiate and draw our chart, passing in some options.
    var chart = new google.visualization.PieChart(document.getElementById('chart_div'));




    function selectHandlerOver(e) {
        //alert('selectHandlerOver');
        var row = e.row;
        var s = $.parseJSON('{ ' +

            '"is3D": "true",' +
            '"slices": {  "' + row + '": { "offset": "0.2" } },' +
            '"animation": { "duration": "100", "easing": "out"}' +
        '}')
        chart.draw(data, s);
    }

    function selectHandlerOut(e) {
        //alert('selectHandlerOut');
        var row = e.row;
        var s = $.parseJSON('{"is3D": "true", "slices": {  "' + row + '": { "offset": "0.0" } } }')
        chart.draw(data, s);

    }

    google.visualization.events.addListener(chart, 'onmouseover', selectHandlerOver);
    google.visualization.events.addListener(chart, 'onmouseout', selectHandlerOut);

    chart.draw(data, options);
} 

我认为这是因为O使用自定义行为覆盖onmouseover事件。有什么建议吗?

这不是因为您已覆盖鼠标悬停事件。这是因为您正在调用它内部的
chart.draw()
。Draw方法取消为上一次渲染的所有工具提示

如果您想要细粒度的控制,最好使用类似于显示工具提示的内容