Jquery 谷歌图表工具提示不会出现在鼠标上方

Jquery 谷歌图表工具提示不会出现在鼠标上方,jquery,charts,google-visualization,Jquery,Charts,Google Visualization,我有一个在线图表,当我用鼠标浏览这些点时,我看不到默认的工具提示。 你能帮我找出原因吗 非常感谢 这是我正在使用的代码,正如您所看到的,我试图手动放置工具提示,但没有结果…: var dataArray= [ ['Weight', 'Volume \n(Performance)', 'Volume \n(Small-Wave)', 'Volume \n (Step-Up)'] ]; //var dataArray= [ ['Weight', 'Volume'] ]; var li

我有一个在线图表,当我用鼠标浏览这些点时,我看不到默认的工具提示。 你能帮我找出原因吗

非常感谢 这是我正在使用的代码,正如您所看到的,我试图手动放置工具提示,但没有结果…:

var dataArray= [ ['Weight', 'Volume \n(Performance)', 'Volume \n(Small-Wave)', 'Volume \n (Step-Up)'] ];
    //var dataArray= [ ['Weight', 'Volume'] ];
    var linearRegX=[];
    var linearRegY=[];
    j=0;
    var tooltipOn = 0;
        for (i = 1; i < prodata.length; ++i) {
            if ( Number(prodata[i]['volume']) !== 0) {
                var tooltipString = prodata[i]['name'] + ' ' + prodata[i]['model'];
                if (prodata[i]['model'] == 'SemiPro12' && prodata[i]['length'] == "6'6" ){  //remove some models
                } else if ( prodata[i]['fun'] == '0') { // performance boards
                linearRegX[j] = Number(prodata[i]['weight']) ;
                linearRegY[j] = Number(prodata[i]['volume']) ;
                if (!tooltipOn){
                    dataArray.push ( [ Number(prodata[i]['weight']), Number(prodata[i]['volume']), null, null ] );
                } else {
                    dataArray.push ( [ Number(prodata[i]['weight']), Number(prodata[i]['volume']), null, null, tooltipString ] );
                }

                j=j+1;
            } else if ( prodata[i]['fun'] == '1') { // small-wave boards
                if (!tooltipOn){
                    dataArray.push ( [ Number(prodata[i]['weight']), null, Number(prodata[i]['volume']), null ] );
                } else {
                    dataArray.push ( [ Number(prodata[i]['weight']), null, Number(prodata[i]['volume']), null, tooltipString ] );
                }                       
            } else if ( prodata[i]['fun'] == '2') { // step-up boards
                if (!tooltipOn){
                    dataArray.push ( [ Number(prodata[i]['weight']), null, null, Number(prodata[i]['volume']) ] );
                } else {
                    dataArray.push ( [ Number(prodata[i]['weight']), null, null, Number(prodata[i]['volume']), tooltipString ] );
                }   

            }
        }
    }
    //option1
    //var data = google.visualization.arrayToDataTable(dataArray);
    //option2
    var data = new google.visualization.DataTable();
    //      console.log("dataArray :");
    //      console.log(dataArray);
    data.addColumn('number', 'Weight');
    data.addColumn('number', 'Volume \n(Performance)');
    data.addColumn('number', 'Volume \n(Small-Wave)');
    data.addColumn('number', 'Volume \n(Step-Up)');     
    //adding tooltips (mouseover info)
    if (tooltipOn){
        data.addColumn({type: 'string', role: 'tooltip'});
    }

    var dataArraySliced = dataArray.slice(1, dataArray.length);
    data.addRows(dataArraySliced);

    var options = {
        title: 'Weight of pro surfer vs. Volume of his pro model',
        hAxis: {title: 'Weight (kg)', minValue: 53, maxValue: 100}, //55
        vAxis: {title: 'Volume (l)'}, //, minValue: 20, maxValue: 40},   //20
        legend: 'none',
           width: '100%',
            height: '100%',
           colors: ['#000000'],
           series: {
                  1: { color: '#06b4c8' }, 
                  2: { color: '#575e6a' }
              },
        legend: {position: 'top right', textStyle: {fontSize: 8}},
        chartArea: {width: '60%'},
           trendlines: { 0: {//type: 'exponential',
                    visibleInLegend: true,
                    color: 'grey',
                    lineWidth: 2,
                    opacity: 0.2,
                    labelInLegend: 'Linear trendline\n(Performance)'
                    } 
                }    // Draw a trendline for data series 0.
    };
    var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));        
    chart.draw(data, options);
    google.visualization.events.addListener(chart, 'ready', myReadyHandler());
var-dataArray=[['Weight','Volume\n(Performance)','Volume\n(Small Wave)','Volume\n(Step)'];
//var dataArray=[['Weight','Volume'];
var linearRegX=[];
var线性关系=[];
j=0;
var工具提示=0;
对于(i=1;i
我在JSFIDLE上复制了您的图表,效果很好:。我看到的唯一问题是调用
myReadyHandler
并在“ready”事件侦听器中传递其返回值(可能是
null
),而不是传递函数本身:

google.visualization.events.addListener(chart, 'ready', myReadyHandler());
应该是:

google.visualization.events.addListener(chart, 'ready', myReadyHandler);
虽然技术上不正确,但不太可能是您的问题的罪魁祸首


我的测试结果也没有与您的相同的维度问题。代码中可能有一些CSS或javascript干扰了图表。我建议从禁用所有javascript和css开始解决这个问题,这对于绘制图表来说并不是绝对必要的。如果问题仍然存在,则可能存在于图表代码中;如果它消失了,那么它就在别处。如果,正如我所怀疑的,它位于其他地方,请尝试逐段启用代码的其余部分,直到图表中断-当这种情况发生时,您已经找到了可能的罪魁祸首。

我遇到了无法再看到工具提示的情况,我无法找出原因。我就是这样来到这里的。我发现我的问题与上面的答案完全无关。这与z-index风格有关。这就是我所拥有的:

<div google-chart chart="chart_summary" style="height: 400px; top: -50px; z-index:-998;" on-ready="chartReady()"></div>

我更改了z-index值以测试其他内容,但忘记了它。因为该值太低,所以它基本上是在覆盖它的其他东西(透明)的后面,从而阻止了mouseover事件被触发

因此,如果您更改了z索引(css可能也会更改),那么您的图形可能被某个z索引高于图形的透明对象隐藏。一个简单的测试就是给它一个很高的z指数,看看你是否仍然有这个问题

<div google-chart chart="chart_summary" style="height: 400px; top: -50px; z-index:1000000;" on-ready="chartReady()"></div>


用一个和您已经尝试解决问题的任何步骤更新您的问题。@asgallant,我刚刚做到了。你能投赞成票吗?谢谢你用
prodata
的例子更新,所以我不能