1

포인트를 클릭하면 경고를 발생시키는 선형 차트가 작성되어 정상적으로 작동합니다. ...확대/축소 및 선택 이벤트가있는 Google 차트 라인

선택 이벤트가 불을 해달라고 eand 클릭은 ( fiddle) 더 이상 작동하지 말아 : I (아래 라인을 주석)을 '탐색기'옵션이 추가 차트의 스크롤 줌을 활성화 할 때

문제는

options = { 
     legend: 'none', 
     format: 'none', 
     hAxis: { textPosition: 'none', gridlines: { count: 0 } }, 
     vAxis: { textPosition: 'none', gridlines: { count: 1 } }, 
     curveType: 'function', 
     pointSize: 20, 


    }; 

    chart = new google.visualization.LineChart(document.getElementById('chart_div'));   

    //If I enable this line, ZOOM works fine but the 'select' event don't work.... 
    //options['explorer'] = {axis: 'horizontal',keepInBounds: true,maxZoomIn: 5.0};   

    chart.draw(data_estruturas, options); 

    //select event 
    google.visualization.events.addListener(chart, 'select', function(e) { 
     var selection = chart.getSelection();  
     if (selection.length > 0) { 
     var estrutura = data_estruturas.getValue(selection[0].row, 0) 
     alert(estrutura); 
     } 
    }); 


}   
fiddle

답변

1

후 추첨 방법을 넣어 선택 이벤트 등록을 확인하시기 바랍니다.

//select event 
google.visualization.events.addListener(chart, 'select', function(e) { 
    var selection = chart.getSelection();  
    if (selection.length > 0) { 
    var estrutura = data_estruturas.getValue(selection[0].row, 0) 
    alert(estrutura); 
    } 
}); 

//After set all options and register events draw the chart 
chart.draw(data_estruturas, options); 

I updated your fiddle