Broker System for Supercredit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3KB

  1. import { Component, OnInit } from '@angular/core';
  2. import {RewardVsIncomeModel} from '../models/reward-vs-incom.model';
  3. import {SeriesLabels} from '@progress/kendo-angular-charts';
  4. import {AuthService} from '../service/auth.service';
  5. import {HttpClient} from '@angular/common/http';
  6. @Component({
  7. selector: 'app-reward-overview',
  8. templateUrl: './reward-overview.component.html',
  9. styleUrls: ['./reward-overview.component.scss']
  10. })
  11. export class RewardOverviewComponent implements OnInit {
  12. public rvi: RewardVsIncomeModel = new RewardVsIncomeModel();
  13. public seriesLabels: SeriesLabels = {
  14. visible: true, // Note that visible defaults to false
  15. padding: 3,
  16. font: 'bold 9px Arial, sans-serif',
  17. format: 'c0'
  18. };
  19. constructor(private auth: AuthService, private http: HttpClient) { }
  20. ngOnInit(): void {
  21. this.loadInitialRewardOverviewChart();
  22. }
  23. public loadInitialRewardOverviewChart(): void{
  24. this.http.get<RewardVsIncomeModel>(this.auth.getUrl('chart/reward-vs-income-monthly')).subscribe(
  25. resp => {
  26. this.rvi.Categories = resp.Categories;
  27. this.rvi.Data[2] = [];
  28. for (let i = 0; i < 12; i++){
  29. this.rvi.Data[0] = resp.Data[0];
  30. this.rvi.Data[1] = resp.Data[1];
  31. this.rvi.Data[2][i] = this.rvi.Data[1][i] - this.rvi.Data[0][i];
  32. }
  33. }
  34. );
  35. }
  36. }