I am using c3.js to display a chart which has parts differentiated by location. On click of a part, i take the location from it and filter my master data. Then i require to display a table below showing the filtered records.
Portion of my code is below:
resultData;
filteredData;
constructor(private appService: AppService) { }
ngOnInit(){
this.apiService.getData('/reportees').subscribe((res)=>{
this.resultData=JSON.parse(res._body);
let value=JSON.parse(JSON.stringify(this.resultData));
this.chart = c3.generate({
data: {
onclick:function(d,element){
this.filteredData=value.filter((record)=>record.location==d.id);
console.log(this.filteredData);
}
When i do a onclick,I could see filteredData getting logged on browser console. But in table, i don't see the rows getting populated. What is known is filteredData is undefined on page load due to which rows are not getting populated. In such case, please help in display of the records in table on click of region dynamically.