Skip to content

Commit 7791d7b

Browse files
author
katherinedragieva
committed
refactor(finjs): refactor code
1 parent cbc1e74 commit 7791d7b

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

projects/app-lob/src/app/grid-finjs/main.component.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class FinJSDemoComponent implements OnDestroy, AfterViewInit {
2626
public darkTheme = false;
2727

2828
public properties = ['price', 'country'];
29-
public chartData = [];
29+
public chartData: Stock[] = [];
3030
public volume = 1000;
3131
public frequency = 500;
3232
private _timer: ReturnType<typeof setInterval>;
@@ -95,15 +95,11 @@ export class FinJSDemoComponent implements OnDestroy, AfterViewInit {
9595

9696
public setChartData(args: Stock[]): void {
9797
this.chartData = [];
98-
this.finGrid.grid.data.filter(data => {
99-
if (args.indexOf(data.id) > -1) {
100-
this.chartData.push({
101-
country: data.country,
102-
price: data.price
103-
});
104-
}
98+
args.forEach(rowKey => {
99+
const row: Stock = this.finGrid.grid.getRowByKey(rowKey).data;
100+
this.chartData.push(row);
101+
this.chart.notifyInsertItem(this.chartData, this.chartData.length - 1, row);
105102
});
106-
this.chart.notifyInsertItem(this.chartData, this.chartData.length - 1, [...args]);
107103
// this.controller.controls[2].disabled = this.chartData.length === 0;
108104
this.setLabelIntervalAndAngle();
109105
this.setChartConfig('Countries', 'Prices (USD)', 'Data Chart with prices by Category and Country');

0 commit comments

Comments
 (0)