How do I add an event/callback for mouse clicks? I've tried adding dispatch and would see the console logs inside the functions, but unable it is unable to see my component variables.
In the code below, i could see console logging, but the setting of displayData is not done. I've also tried calling a function inside dispatch, but the browser says it is undefined. What I want to is to be able to call my own function on a mouse click event.
displayData: string = "abc"; ngOnInit(){ this.options = { chart: { type: 'historicalBarChart', height: 70, color: ["#2BBED8"], margin : { top: 0, right: 10, bottom: 10, left: 10 }, dispatch: { //container of event handlers elementMousemove: function(e){ console.log("mousemove"+ JSON.stringify(e)); this.displayData = "xyz" }, elementMouseout: function(e){ console.log('mouseout'+ JSON.stringify(e)) }, chartClick: function(e){ this.displayData = "xyz"; console.log('chartClick'+ JSON.stringify(e)) }, elementClick: function(e){ console.log('elementClick'+ JSON.stringify(e)) }, elementDblclick: function(e){ console.log('double click' + JSON.stringify(e)) } },
Hi,
How do I add an event/callback for mouse clicks? I've tried adding dispatch and would see the console logs inside the functions, but unable it is unable to see my component variables.
In the code below, i could see console logging, but the setting of displayData is not done. I've also tried calling a function inside dispatch, but the browser says it is undefined. What I want to is to be able to call my own function on a mouse click event.
displayData: string = "abc"; ngOnInit(){ this.options = { chart: { type: 'historicalBarChart', height: 70, color: ["#2BBED8"], margin : { top: 0, right: 10, bottom: 10, left: 10 }, dispatch: { //container of event handlers elementMousemove: function(e){ console.log("mousemove"+ JSON.stringify(e)); this.displayData = "xyz" }, elementMouseout: function(e){ console.log('mouseout'+ JSON.stringify(e)) }, chartClick: function(e){ this.displayData = "xyz"; console.log('chartClick'+ JSON.stringify(e)) }, elementClick: function(e){ console.log('elementClick'+ JSON.stringify(e)) }, elementDblclick: function(e){ console.log('double click' + JSON.stringify(e)) } },
Thanks,