Skip to content

DashboardWidget

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/models/dashboard/dashboard-widget.model.ts (line 10)

Part of: Pams

DashboardWidget models a dashboard widget and coordinates its labels, data source state, color settings, schema, selections, and chart data. It is used by dashboard UI code to rebuild widget state when data or display configuration changes.

Methods

MethodSignatureReturns
syncLabelssyncLabels(source: Array<string>)void
DataSourceChangedDataSourceChanged()void
ChangeColorChangeColor(serial: string, value: string)void
UpdateColorsUpdateColors()void
BuildSchemaBuildSchema()void
CombaineSelectionCombaineSelection()void
updateChartsColorupdateChartsColor()void
createPieDatacreatePieData(dataSource: undefined, chart: undefined)void

Properties

PropertyType
IDnumber
PrimaryIDnumber
FilterEditingObjectFilterEditingObject[]
DisplayIDstring
Captionstring
DatasourceInitany[]
Datasourceany
OrginalDatasourceany
MasterFilterboolean
AcceptFilterany[]
chartsany
FilterStringstring
FilterSelectionTypestring
ChartSeriseSelectionTypestring
CurrentDataany
tableTable
viewView
isTableboolean
CenterRangeboolean
Operationsany[]
DataOperationsDashboardDataFields[]
IsSelectedboolean
isNestedboolean
Stackedboolean
ExpBarboolean
selectedArgumentArray<DimensionField>
selectedSeriseArray<DimensionField>
AutoColoredMeasureboolean
ColorschemaListArray<schema>
colorCounternumber
colorPlatteany[]
ItemGridStackItem
WidgetTypeDashboardWidgetTypeEnum
GridStackMainWidthnumber
ColorContextany
ColorBehaviorboolean
widgetLabelsArray<{label:string ,priority:number}>
ColumnFieldsany[]
ValueFieldsany[]
GroupByFieldsany[]
XaxisFieldsany[]
YaxisFieldsany[]

Where it refuses work

  • DashboardWidget stops the work with an early return when inx == all_Fields.length.

Diagram

mermaid
graph LR
  DataSource[Data source change] --> DataSourceChanged
  DataSourceChanged --> BuildSchema
  BuildSchema --> CombaineSelection
  CombaineSelection --> createPieData
  Labels[Label updates] --> syncLabels
  Colors[Color changes] --> ChangeColor
  ChangeColor --> UpdateColors
  UpdateColors --> updateChartsColor
  createPieData --> Chart[Chart rendering]
  updateChartsColor --> Chart

Usage

ts
import { DashboardWidget } from './models/dashboard/dashboard-widget.model';

function refreshDashboardWidget(widget: DashboardWidget): void {
  widget.DataSourceChanged();
  widget.BuildSchema();
  widget.CombaineSelection();

  widget.syncLabels();
  widget.UpdateColors();
  widget.updateChartsColor();

  widget.createPieData();
}

AI Coding Instructions

  • Call DataSourceChanged() before rebuilding schema or chart data after the widget's data source changes.
  • Keep label updates in syncLabels() so displayed labels remain aligned with widget configuration.
  • Use ChangeColor(), UpdateColors(), and updateChartsColor() together when changing chart colors.
  • Rebuild selection state with CombaineSelection() before generating data through createPieData().
  • Preserve the existing method naming when integrating with callers, including CombaineSelection().

Relationships

  • IMPORTS → DashboardWidgetTypeEnum
  • IMPORTS → Table
  • IMPORTS → View
  • IMPORTS → platte
  • IMPORTS → Query
  • IMPORTS → DashboardDataFields
  • IMPORTS → DataTypeEnum
  • IMPORTS → OperationTypeEnum
  • IMPORTS → QueryTypeEnum
  • IMPORTS → chartType
  • IMPORTS → DimensionField

Used by

6 references from 6 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (6)

  • GridBarChartComponentPams/Web/Pams.Web/Client/app/components/shared/grid-bar-chart/grid-bar-chart.component.ts:1
  • PamsBarChartComponentPams/Web/Pams.Web/Client/app/components/shared/pams-bar-chart/pams-bar-chart.component.ts:1
  • PamsPieChartComponentPams/Web/Pams.Web/Client/app/components/shared/pams-pie-chart/pams-pie-chart.component.ts:1
  • DashboardWidgetOperationsServicePams/Web/Pams.Web/Client/app/services/dashboard/dashboard-widget-operations.service.ts:1
  • DashboardGroupPams/Web/Pams.Web/Client/app/models/dashboard/dashboard-group.model.ts:2
  • OperationsPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-operations.ts:15

Was this page helpful?

Download as PDF