Angular 根据“角度”中的下拉列表值呈现不同的图表
我有一个带有一些选项的mat select,我正在根据映射到特定选项的Angular 根据“角度”中的下拉列表值呈现不同的图表,angular,typescript,angular6,google-visualization,Angular,Typescript,Angular6,Google Visualization,我有一个带有一些选项的mat select,我正在根据映射到特定选项的value数据绘制一个谷歌折线图 当我更改选择时,我可以看到值随着selectionChange($event)函数的变化而变化,我想要的数据也是正确的,但是,图表div没有得到更新/重新呈现 如何使其在选项更改时更新 以下是我的一些代码: <mat-form-field class="cDropdown"> <mat-select [(ngModel)]="ids[a.name]" panel
value
数据绘制一个谷歌折线图
当我更改选择时,我可以看到值随着selectionChange($event)
函数的变化而变化,我想要的数据也是正确的,但是,图表div没有得到更新/重新呈现
如何使其在选项更改时更新
以下是我的一些代码:
<mat-form-field class="cDropdown">
<mat-select [(ngModel)]="ids[a.name]" panelClass="selectplantdropdown" (selectionChange)="onChangeEvent($event)">
<mat-option [value]=a.id>{{ a.name }}</mat-option>
<ng-container *ngFor="let b of temp">
<mat-option [value]=b.id (click)="switchCustomer()">
{{ b.name }}
</mat-option>
</ng-container>
</mat-select>
</mat-form-field>
共享您的ts代码请从.ts文件添加代码请共享onchangevent
函数体我已共享了.ts文件中的代码。请看一看。
<div style="font-weight: bolder; padding: 10% 40%">{{ chartData[ids[a.name]][0].data[1] }} {{ ids[a.name] }} CHART GOES HERE
</div> /*I can see the values changing here as well*/
<div>
<app-linechart [data]="chartData[ids[a.name]][0].data" [config]="config" [elementId]="ids[a.name]"></app-linechart>
</div>
onChangeEvent(event) {
console.log(event.value);
console.log(JSON.stringify(this.chartData[event.value][0].data));
}