Home › Forums › Chart Support › Charts with drop down button to filter › Reply To: Charts with drop down button to filter
@suneetha5454,
To modify a chart based on dropdown selection you need to update the chart options / data according to the options selected from the dropdown list using the ngModelChange event. Please check the code snippet below –
HTML
<select [(ngModel)]="selectedValue" (ngModelChange)='onChange($event)'> <option *ngFor="let option of options" [value]="option.id"> {{option.name}} </option> </select>
TS
onChange(val:any){ let dps = this.jsonData[val]; this.chart.options.data[0].dataPoints = dps; this.chart.render(); }
Also, kindly take a look at this StackBlitz for a working example.
___________ Indranil Deo Team CanvasJS