Skip to content

WidgetPrincipalsTendancyComponent

reference
1 min readUpdated

Kind: Class

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

Part of: Frontend

WidgetPrincipalsTendancyComponent manages dashboard data and chart presentation for principal tendency information. It checks feature subscription access, initializes the chart, and derives values, colors, and chart height for rendering.

Extends: BaseWidgetComponent

Implements: OnInit

Methods

MethodSignatureReturns
getDashboardDatagetDashboardData()void
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
onChartInitonChartInit(e: any, index: number)void
setValuesetValue(value: number)void
setColorsetColor(value: number)string
chartHeightchartHeight()string

Properties

PropertyType
_widgetWidget
todayWidgetsEnumany
PrincipalsPrincipalsTendancy[]
initOptsany
seriesany[]
headerDataany
echartsIntanceany
optionsany
TargetBooking`string
AchievedBooking`string
currenFeaturenumber

Where it refuses work

  • WidgetPrincipalsTendancyComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • WidgetPrincipalsTendancyComponent stops the work with an early return when value > 150.

Diagram

mermaid
graph LR
  Init[ngOnInit] --> Subscription[checkFeatureSubscription]
  Subscription -->|Allowed| Data[getDashboardData]
  Data --> ChartInit[onChartInit]
  ChartInit --> Value[setValue]
  ChartInit --> Color[setColor]
  ChartInit --> Height[chartHeight]
  Subscription -->|Not allowed| Restricted[Render restricted state]

Usage

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

@Component({
  selector: 'app-dashboard-host',
  template: `
    <app-widget-principals-tendancy
      #principalsWidget>
    </app-widget-principals-tendancy>
  `
})
export class DashboardHostComponent {
  @ViewChild('principalsWidget')
  principalsWidget!: WidgetPrincipalsTendancyComponent;

  refreshWidget(): void {
    if (this.principalsWidget.checkFeatureSubscription()) {
      this.principalsWidget.getDashboardData();
      this.principalsWidget.onChartInit();
    }
  }
}

AI Coding Instructions

  • Keep feature-access checks through checkFeatureSubscription() before requesting or rendering subscription-dependent dashboard data.
  • Call getDashboardData() as part of component initialization or refresh flows; avoid duplicating its data-loading logic in parent components.
  • Keep chart setup in onChartInit() and use setValue(), setColor(), and chartHeight() for chart-specific display state.
  • Preserve Angular lifecycle behavior by keeping initialization work in ngOnInit() rather than requiring callers to construct the component directly.

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