Skip to content

WidgetTeamsTendancyComponent

reference
1 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/widget-teams-tendancy/widget-teams-tendancy.component.ts (line 21)

Part of: Pams

WidgetTeamsTendancyComponent manages dashboard data and chart behavior for the teams tendency widget. It handles data loading, cached state, value changes, chart initialization, resize events, lifecycle cleanup, and chart type switching.

Implements: OnInit, DoCheck

Methods

MethodSignatureReturns
getDashboardDatagetDashboardData()void
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
onValueChangedonValueChanged(e: undefined)void
ngOnInitngOnInit()void
ngDoCheckngDoCheck()void
onChartInitonChartInit(e: any, index: number)void
ngOnDestroyngOnDestroy()void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
setValuesetValue(value: number)void

Properties

PropertyType
triangleNeedleDxCircularGaugeComponent
originalWidgetWidget
_widgetWidget
numYearsnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
teamsTeamsTendancy[]
withNominalboolean
basedOnTendencyboolean
subscriptionSubscription
initOptsany
seriesany[]
headerDataany
echartsIntanceany
optionsany
TargetBooking`string
AchievedBooking`string

Where it refuses work

  • WidgetTeamsTendancyComponent stops the work with an early return when isNumber(value).

Diagram

mermaid
graph LR
  Dashboard[Dashboard] --> WidgetTeamsTendancyComponent
  WidgetTeamsTendancyComponent --> Data[getDashboardData]
  WidgetTeamsTendancyComponent --> Cache[setChaching / getChaching]
  WidgetTeamsTendancyComponent --> Chart[onChartInit]
  WidgetTeamsTendancyComponent --> Resize[onResize]
  WidgetTeamsTendancyComponent --> ChartType[switchChartTypeHandler]
  WidgetTeamsTendancyComponent --> Cleanup[ngOnDestroy]

Usage

ts
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { WidgetTeamsTendancyComponent } from './widget-teams-tendancy.component';

@Component({
  selector: 'app-dashboard-host',
  template: `
    <app-widget-teams-tendancy #teamsWidget></app-widget-teams-tendancy>
    <button type="button" (click)="refreshTeamsWidget()">Refresh</button>
  `
})
export class DashboardHostComponent implements AfterViewInit {
  @ViewChild('teamsWidget')
  teamsWidget?: WidgetTeamsTendancyComponent;

  ngAfterViewInit(): void {
    this.teamsWidget?.getDashboardData();
  }

  refreshTeamsWidget(): void {
    this.teamsWidget?.getDashboardData();
  }
}

AI Coding Instructions

  • Keep dashboard data retrieval inside getDashboardData() so refresh behavior remains in one place.
  • Use setChaching() and getChaching() together when preserving widget state between dashboard updates.
  • Do not call Angular lifecycle methods such as ngOnInit(), ngDoCheck(), or ngOnDestroy() from application code.
  • Route chart setup through onChartInit() and chart mode changes through switchChartTypeHandler().
  • Keep resize-related chart updates in onResize() to avoid duplicating chart layout logic.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1

Was this page helpful?

Download as PDF