Quiero agregar un clic en el punto trazado de dónde, qué, cómo y cuándo. Como quiero que los puntos 'Dónde', 'Qué', 'Cómo' y 'Cuándo' actúen como un botón de clic. Estoy usando angular-google-charts - npm.
Mi código es -
private drawChart(){ let data = this.gLib.visualization.arrayToDataTable([ ['Aspect', 'Splash'], ['Where', 1 ], ['What', 2 ], ['How', 3 ], ['When', 4 ] ]); var options = {'title':'How Much Pizza I Ate Last Night', 'width':400, 'height':300}; var chart:any = new this.gLib.visualization.LineChart(document.getElementById('divLineChart')); google.visualization.events.addListener(chart, 'select', this.selectHandler); chart.draw(data, options); chart.draw(data); } selectHandler() { var chart:any = new this.gLib.visualization.LineChart(document.getElementById('divLineChart')); let data = this.gLib.visualization.arrayToDataTable([ ['Aspect', 'Splash'], ['Where', 1 ], ['What', 2 ], ['How', 3 ], ['When', 4 ] ]); var selectedItem = chart.getSelection()[1]; console.log("selectedItem = ", selectedItem) var value = data.getValue(selectedItem.row, 1); console.log("value = ", value); alert('The user selected ' + value); }Mirando la documentación del paquete, parece haber un par de eventos que pueden ayudarlo con eso. Es decir, seleccionar parecen ser los más adecuados.