Skip to content

WidgetTeamsTendancyComponent

reference
1 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/widget-teams-tendancy/widget-teams-tendancy.component.ts (line 18)

Part of: Frontend

WidgetTeamsTendancyComponent is an Angular dashboard widget that retrieves and displays team tendency data. It manages feature-subscription checks, chart initialization and type switching, cache handling, value updates, and resize behavior within the dashboard widget lifecycle.

Extends: BaseWidgetComponent

Implements: OnInit, DoCheck

Methods

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

Properties

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

Where it refuses work

  • WidgetTeamsTendancyComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • WidgetTeamsTendancyComponent stops the work with an early return when !Number.isNaN(value).

Diagram

mermaid
graph LR
  Dashboard[Dashboard Container] --> Widget[WidgetTeamsTendancyComponent]
  Widget --> Subscription[checkFeatureSubscription]
  Subscription --> Data[getDashboardData]
  Widget --> Cache[getChaching / setChaching]
  Data --> Chart[onChartInit]
  Widget --> Values[onValueChanged]
  Widget --> ChartType[switchChartTypeHandler]
  Widget --> Resize[onResize]
  Widget --> Lifecycle[ngOnInit / ngDoCheck]

Usage

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

@Component({
  selector: 'app-dashboard-page',
  template: `
    <app-widget-teams-tendancy #teamsTendancyWidget />
    <button type="button" (click)="refreshTeamsTendency()">
      Refresh
    </button>
  `
})
export class DashboardPageComponent {
  @ViewChild('teamsTendancyWidget')
  teamsTendancyWidget?: WidgetTeamsTendancyComponent;

  refreshTeamsTendency(): void {
    const widget = this.teamsTendancyWidget;

    if (widget?.checkFeatureSubscription()) {
      widget.getDashboardData();
    }
  }

  changeChartType(): void {
    this.teamsTendancyWidget?.switchChartTypeHandler();
  }
}

AI Coding Instructions

  • Keep Angular lifecycle handling in ngOnInit and ngDoCheck; do not call lifecycle hooks directly from application code.
  • Check checkFeatureSubscription() before triggering data retrieval or exposing widget actions that require a subscribed feature.
  • Keep cache reads and writes paired through getChaching() and setChaching() rather than adding separate storage behavior.
  • Route chart-related updates through onChartInit(), onValueChanged(), and switchChartTypeHandler() so chart state remains in the component.
  • Preserve resize handling through onResize() when changing the widget container or chart integration.

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)

  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1

Was this page helpful?

Download as PDF