# Chart

**Kind:** Class

**Source:** `Pams/Web/Pams.WebApp/Client/app/core/models/dashboard-data-fields.ts` (line 434)

**Part of:** [Pams](subsystem-pams)

`Chart` models dashboard chart field metadata, including field names, stored names, captions, compared field names, and hidden state. Dashboard code reads and updates this metadata when configuring chart display and saved field references.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `isHidden` | `isHidden()` | `boolean` |
| `setHidden` | `setHidden(flag: boolean)` | `void` |
| `GetStoredName` | `GetStoredName()` | `string` |
| `SetStoredName` | `SetStoredName(name: string)` | `void` |
| `GetComparedFieldName` | `GetComparedFieldName()` | `string` |
| `SetComparedFieldName` | `SetComparedFieldName(name: string)` | `void` |
| `GetFieldName` | `GetFieldName()` | `string` |
| `SetFieldName` | `SetFieldName(name: string)` | `void` |
| `GetCaption` | `GetCaption()` | `string` |
| `SetCaption` | `SetCaption(input: string)` | `void` |
| `SetDataType` | `SetDataType(ty: DataTypeEnum)` | `void` |
| `GetDataType` | `GetDataType()` | `DataTypeEnum` |
| `GetFieldNameAgru` | `GetFieldNameAgru()` | `string` |
| `SetFieldNameAgru` | `SetFieldNameAgru(name: string)` | `void` |
| `GetStoredNameAgru` | `GetStoredNameAgru()` | `string` |
| `SetStoredNameAgru` | `SetStoredNameAgru(name: string)` | `void` |
| `GetTypeAgru` | `GetTypeAgru()` | `DateGroupEnum` |
| `SetTypeAgru` | `SetTypeAgru(dt: DateGroupEnum)` | `void` |

## Where it refuses work

- `Chart` stops the work with an early return when `this.FieldName`.

## Diagram

```mermaid
graph LR
  Chart --> HiddenState[isHidden / setHidden]
  Chart --> StoredName[GetStoredName / SetStoredName]
  Chart --> ComparedField[GetComparedFieldName / SetComparedFieldName]
  Chart --> FieldName[GetFieldName / SetFieldName]
  Chart --> Caption[GetCaption / SetCaption]
```

## Usage

```ts
import { Chart } from './core/models/dashboard-data-fields';

const chart = new Chart();

chart.SetStoredName('sales-chart');
chart.SetFieldName('Revenue');
chart.SetComparedFieldName('PreviousRevenue');
chart.SetCaption('Revenue comparison');

if (!chart.isHidden()) {
  console.log(chart.GetCaption());
  console.log(chart.GetFieldName());
}
```

## AI Coding Instructions

- Keep the existing method casing when calling accessors, such as `GetFieldName()` and `SetCaption()`.
- Keep stored names, field names, and compared field names aligned with dashboard field identifiers.
- Check `isHidden()` before rendering or adding a chart field to dashboard UI state.
- Treat `setHidden()` as a state change and verify its implementation before depending on its repeated-call behavior.
