I want to add a click on the plotted point of where, what, how and when. Like I want the 'Where' , 'What', 'How' and 'When' points to act as a click button . I am using angular-google-charts - npm.
My Code is -
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);
}