# Building & Managing Charts

Part of [AI Analytics](https://docs.revenium.io/ai-analytics) - This feature extends AI Analytics with custom visualization capabilities

Chart Builder enables you to create custom visualizations for your AI analytics data. Configure metrics, filters, and chart properties through a form-based interface. Charts can be saved, edited, cloned, and added to the Custom Charts Viewer dashboard.

**Access:** AI Analytics > Chart Builder, Manage Charts or click **Create Chart**

### Managing Charts

<figure><img src="https://2470865788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUfCzMW8qWeXstipFXEh%2Fuploads%2Fgit-blob-8f362d1e34386fe0b09d16ab1a8d1fd7530fbc2d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Creating a Chart

You can view, edit, clone, and delete charts from the Chart Builder list.

> **Note:** Charts are dynamic—options shown depend on related selections (e.g., Line Charts show Time Grain, Pie Charts require Group By). Refer to in-app tooltips (💡 icons) for the latest details on each field.

<figure><img src="https://2470865788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUfCzMW8qWeXstipFXEh%2Fuploads%2Fgit-blob-126a91f9cc6643e64d548a021a8beaa029ba2f48%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

For more information on Managing Charts[ see below](#managing-charts)

#### Step 1: Basic Information

**Chart Name\*** (required, max 255 characters) - Descriptive name for your chart

**Description** (optional, max 1000 characters) - Additional context about what the chart shows

**Chart Type\*** (required)

* **Line Chart** - Shows trends over time
* **Bar Chart** - Compares values across categories (horizontal orientation)
* **Column Chart** - Compares values across categories (vertical orientation)
* **Pie Chart** - Shows proportions of a whole

💡 *Tooltip available via "?" HelpIcon*

***

#### Step 2: Data Configuration

**Chart Mode**

Mode is automatically determined by your Chart Type selection:

* **Time Series** - For Line Charts (displays data over time)
* **Aggregate** - For Bar, Column, and Pie Charts (summarized data)

💡 *Tooltip available via "?" HelpIcon*

**Automatic behavior:**

* Line Chart → locks to Time Series mode
* Bar → lock to Aggregate mode
* Column Charts → Time Series or Aggregate mode
* Pie Chart → locks to Aggregate mode

***

**Time Period**

**Date Range** (required)

* Choose from available options

**Time Grain** (shown only for Time Series mode - \[Line+Column Charts])

Option shown varies by Date Range - Longer Rang = larger grain

* Auto (All ranges)
* Hour (7 days or less)
* Daily (All ranges)
* Week (>7 days range)
* Month (>60 days range)

***

**Primary Metric**

**Base Metric\*** (required)

* Selects the fundamental data point to measure
* Options loaded dynamically from your data
* Examples:
  * **Costs** (Currency/USD) - Total AI provider costs
  * **Tokens** (Count) - AI tokens processed (input + output)
  * **Requests** (Count) - Number of AI API requests
  * **Latency** (Milliseconds) - AI API response time

**Calculation\*** (required)

* Determines how the metric is calculated
* Options depend on selected Base Metric
* Common options:
  * Total - Sum all values
  * Average - Mean value
  * Per-Request Average
  * Per-Token Average
  * Per-Entity Average (requires Entity Type)

**Disabled until Base Metric is selected** **Auto-selects first available calculation when Base Metric changes**

**Entity Type** (required only for Per-Entity Average calculation)

* Specifies which dimension the metric measures
* Options loaded dynamically (e.g., API Key, Model, Customer, Agent, Product, Provider, Task)
* **Cannot be the same as Group By selection**

***

**Grouping**

**Primary Group By** (optional, except Pie Charts require it)

* Splits data into separate series
* Options loaded dynamically (e.g., Provider, Model, Customer, Agent, Product, Task, none)
* Has a different effect on each chart e.g: Each group becomes a separate slice on a bar chart

**Constraints:**

* Pie Charts cannot have Group By = "none"
* Cannot be the same as Entity Type
* Entity Type option is removed from Group By dropdown when selected

***

#### Step 3: Filters (Optional)

<figure><img src="https://2470865788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUfCzMW8qWeXstipFXEh%2Fuploads%2Fgit-blob-5d449f9069e33218e81d061bed29facfd88ee7e0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Apply conditions to limit data in your chart. Multiple filters use AND logic.

**Each filter contains:**

**Field** (required)

* Selects which data field to filter
* Options loaded dynamically from your data

**Operator** (required)

**Value** (required for most operators)

* Input type varies by operator:
  * Standard operators: single input
  * Between: two inputs (Min, Max)
  * In/Not In: multi-value or comma-separated input
  * Is Null/Is Not Null: no input shown

**Actions:**

* Click **Add Filter** to add a new filter
* Click trash icon to remove a filter

***

#### Step 4: Chart Focus (Optional)

Controls which data points appear in the chart.

**Focus Method:**

**Show All Data** (default)

* Displays all available data points

**Top N Items**

* Shows only the top N items by value
* **Number of Top Items** field: 1-100
* Placeholder: "e.g., 10"
* 💡 *Tooltip available via "?" HelpIcon*

**Value Threshold**

* Shows only items above a minimum value
* **Min Value Threshold** field: numeric (step 0.01)
* Placeholder: "e.g., 100.00"

***

#### Step 5: Review & Save

1. Review chart in the **live preview** panel (right side)
2. Verify data appears as expected
3. Click **Save** to store the chart definition
4. Chart appears in Chart Builder list
5. Add to dashboards via Custom Charts Viewer

***

### MANAGING CHARTS

You can view, edit, clone, and delete charts from the Chart Builder list.

<figure><img src="https://2470865788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUfCzMW8qWeXstipFXEh%2Fuploads%2Fgit-blob-4a555307bf133121885e5745a4653cf952dbc05c%2Fimage%20(66).png?alt=media" alt=""><figcaption></figcaption></figure>

***

### TIPS & BEST PRACTICES

**Chart Selection:**

* Line Charts: trends over time
* Bar/Column Charts: category comparisons
* Pie Charts: proportional breakdowns (limit to 8-10 categories)

**Performance:**

* Use Chart Focus (Top N or Threshold) for large datasets
* Choose appropriate Time Grain (hourly over 90 days = many data points)
* Apply filters to reduce data volume before visualization

**Data Quality:**

* Validate data in live preview before saving
* Use filters to exclude test or invalid data
* Check that Group By produces manageable number of series
