# Graph Dashboard Widget

<p class="callout info">The **Graph Widget** presents system data in a dynamic visual chart format powered by Chart.js. Its primary purpose is to help administrators analyze operational trends—such as ticket issuance volume, active permit distribution, LPR scan activity, and dispatch logs—over time or across specific operational categories. This article is intended for OPSCOM administrators.</p>

## Setup and Configuration

The Graph widget is built directly into the dashboard framework.

- **Admin Side:** Administrators must have system role permissions enabled to edit dashboards (dashboard\_edit\_any or ownership of the target dashboard).
- **Data Sources:** Supports aggregated data from **Violation Stats**, **Permit Stats (Beta)**, **LPR Stats**, **Active Permits (Beta)**, **Permit Activity (Beta)**, **Dispatch Stats (Beta)**, and **Incident Stats (Beta)**.

## Using this Feature

Administrators can use the following instructions to add and configure a Graph widget on any customizable dashboard workspace.

### Adding and Configuring the Graph Widget

1. Open your target dashboard, toggle **Edit Mode** to **On**, and click **+ Add Widget**.
2. Select **Graph Widget** from the gallery.
3. Click the gear icon (**Settings**) in the widget header to open configuration settings.
4. Select your **Widget Name**, **Data Source**, and preferred **Chart Type** (*Bar*, *Stacked Bar*, *Line*, *Pie*, or *Doughnut*).

### Display and Filter Options

#### Display Settings Tab

Display options adjust automatically based on your selected **Data Source**:

- **Standard Stats (Violation, Permit, Dispatch, Incident, LPR):** Customize your date range (**Time Period**), time intervals (**Time Grouping**), data grouping (**Group By** attributes like lot, camera, or permit type), metric (**Count** vs. **Revenue**), and sort order.
- **Active Permits (Beta):** Configure **Group By** and **Stack By** attributes (Lot, Lot Zone, or Permit Type) to structure stacked visual comparisons.
- **Permit Activity (Beta):** Define your relative **Time Period**, choose interval granularity via **Bucket Size**, and set the **Auto Refresh** rate.

#### Filter Settings Tab

Filters adapt dynamically based on your selected **Data Source**:

- **Violation Stats:** Refine by **Payment Status** (*Unpaid*, *Overdue*, *Paid*, *Collections*) or toggle options to isolate **Payable Only** (excludes warnings/spoiled tickets), **Geo Coordinates Only**, or **Active Writer** tickets.
- **Permit Stats (Beta):** Toggle **Active** permits only, or filter by specific **Permit Type**, **Lots**, **Lot Group**, or **Lot Zone**.
- **Dispatch Stats (Beta):** Toggle **Parent Logs Only** to exclude sub-logs, or filter by **Log Status**.

Click **Save** to apply your configuration and render the graph.

## Available Controls and Display Modes

### Widget Header Toolbar

- **Refresh (circular arrow icon):** Updates the graph to fetch and display the latest backend data.
- **Download Raw CSV (green tray/arrow icon):** Exports the raw tabular data points into a `.csv` file.
- **Settings (gear icon):** Opens the configuration modal to modify data sources, rules, and filters.
- **Duplicate (double box icon):** Clones the widget tile with matching settings onto your active dashboard.

---

## <span style="color: rgb(22, 145, 121);">Best Practices and Considerations</span>

- <span style="color: rgb(22, 145, 121);">**Chart Type Selection:** Use **Bar** or **Stacked Bar** charts for discrete categories/lots, **Line** charts for time trends, and **Pie/Doughnut** charts for relative percentage distributions across small datasets.</span>
- <span style="color: rgb(22, 145, 121);">**Point in Time Compatibility:** When a global Point in Time anchor is active on the dashboard, relative time windows evaluate backward from that timestamp, and auto-refresh pauses automatically.</span>
- <span style="color: rgb(22, 145, 121);">**Combine with List Widgets:** Place a Graph widget side-by-side with a **List Widget** configured with the exact same data source and filters to provide a high-level visual chart alongside a granular record drill-down on a single screen.</span>