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
| Method | Signature | Returns |
|---|---|---|
getDashboardData | getDashboardData() | void |
checkFeatureSubscription | checkFeatureSubscription() | boolean |
ngOnInit | ngOnInit() | void |
onChartInit | onChartInit(e: any, index: number) | void |
setValue | setValue(value: number) | void |
setColor | setColor(value: number) | string |
chartHeight | chartHeight() | string |
Properties
| Property | Type |
|---|---|
_widget | Widget |
todayWidgetsEnum | any |
Principals | PrincipalsTendancy[] |
initOpts | any |
series | any[] |
headerData | any |
echartsIntance | any |
options | any |
TargetBooking | `string |
AchievedBooking | `string |
currenFeature | number |
Where it refuses work
WidgetPrincipalsTendancyComponentstops the work with an early return whenthis.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).WidgetPrincipalsTendancyComponentstops the work with an early return whenvalue > 150.
Diagram
mermaidgraph 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
tsimport { 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 usesetValue(),setColor(), andchartHeight()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)
DashboardWidgetsModule—Frontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
Was this page helpful?