Posts

Showing posts with the label charts

angular2 and charts.js interaction

angular2 and charts.js interaction I'm working currently with some charts from charts.js, i'm adding some simple interaction with them, when the user clicks a bar from a bar chart, a variable saves which bar was clicked. This variable updates a line chart, this chart is updated with data previously saved in an array, so everytime the user clicks a different bar from the bar chart, the line chart should change. My problem is that the variable doesn't change i get two different values. By default the variable is initialized in 0. Console log output: from barchart click:3 from change function:0 from barchart click:2 from change function:0 I print these lines from 2 different functions that happen at the same time. This is function that should change the variable value when the bar chart is clicked on a bar. graphClickEvent(event:any, array:any){ if(array[0]){ this.offsetGraficas = array[0]._index; console.log("from barchart click:"+this.offsetGra...