# Show Chart

`Show_Chart` renders standard inline charts for simple exploratory visuals inside chat. It supports exactly 3 chart kinds: `trend`, `comparison`, and `leaderboard`.

## When To Use

* Use `trend` for ordered time or sequence data where caller-provided row order matters.
* Use `comparison` for grouped vertical-bar comparisons across short categorical labels.
* Use `leaderboard` for a single ranked metric shown as horizontal bars.
* Do not use `Show_Chart` for bespoke graphics, heavy annotations, multi-panel layouts, or presentation polish. Use the shell graphics path for those cases.

## Contract

* Required top-level keys:
  * `id`
  * `kind`
  * `rows`
  * `labelKey`
  * `series`
* Optional top-level keys:
  * `title`
  * `description`
  * `fullLabelKey`
  * `valueFormat`
  * `maxItems`
  * `footnote`

## Row And Series Rules

* Every row must contain the field named by `labelKey`.
* If `fullLabelKey` is provided, every row must contain that field too.
* Every `series.key` must exist in every row.
* Every `series.key` value must be numeric.
* Numeric values should be JSON numbers, not quoted strings like `"12"` or text like `"N/A"`.
* Validation failures should be fixed in the payload, not ignored or retried with the same shape.

## Mode Behavior

* `trend`
  * preserves caller-provided row order
  * supports 1-4 series
  * renders a standard line chart
  * does not auto-sort rows
* `comparison`
  * preserves caller-provided row order
  * supports 1-4 series
  * renders grouped vertical bars
  * does not stack bars
* `leaderboard`
  * requires exactly 1 series
  * sorts rows descending by that series key
  * applies `maxItems` after sorting
  * defaults `maxItems` to `10`
  * renders ranked horizontal bars

## `valueFormat`

* `valueFormat` is an optional strict object, not a shorthand string.
* Use `"compact": true` for large money or count values so axes and direct value labels remain readable in compact inline cards. Hover tooltips can still expose the full value.
* Valid shape:

```json
{
  "kind": "currency",
  "currency": "USD",
  "compact": true
}
```

* `kind` values:
  * `number`
  * `currency`
  * `percent`
* `basis` values for percent formatting:
  * `fraction`
  * `unit`

## Minimal Examples

Trend:

```json
{
  "id": "monthly-revenue-trend",
  "kind": "trend",
  "rows": [
    {"monthLabel": "Jan", "revenue": 4200, "expenses": 2100},
    {"monthLabel": "Feb", "revenue": 5100, "expenses": 2600}
  ],
  "labelKey": "monthLabel",
  "series": [
    {"key": "revenue", "label": "Revenue"},
    {"key": "expenses", "label": "Expenses"}
  ],
  "valueFormat": {"kind": "currency", "currency": "USD", "compact": true}
}
```

Comparison:

```json
{
  "id": "buyer-comparison",
  "kind": "comparison",
  "rows": [
    {"buyer": "Air Force", "awards": 42, "obligations": 58000000},
    {"buyer": "Army", "awards": 35, "obligations": 47000000}
  ],
  "labelKey": "buyer",
  "series": [
    {"key": "awards", "label": "Awards"},
    {"key": "obligations", "label": "Obligations"}
  ],
  "valueFormat": {"kind": "number", "compact": true}
}
```

Leaderboard:

```json
{
  "id": "vendor-leaderboard",
  "kind": "leaderboard",
  "rows": [
    {"vendor_short": "Booz Allen", "vendor_full": "Booz Allen Hamilton Inc.", "awardValue": 842000000},
    {"vendor_short": "Leidos", "vendor_full": "Leidos, Inc.", "awardValue": 774000000}
  ],
  "labelKey": "vendor_short",
  "fullLabelKey": "vendor_full",
  "series": [
    {"key": "awardValue", "label": "Award Value"}
  ],
  "maxItems": 10,
  "valueFormat": {"kind": "currency", "currency": "USD", "compact": true}
}
```

## Rendering Constraints

* Best for standard inline charts in chat, not custom-designed graphics.
* Large currency and count charts should use compact magnitude formatting such as `$2.4B`, `$844.4M`, or `1.2K`.
* `comparison` is best when category labels are short enough to remain readable in grouped vertical bars.
* `leaderboard` is the right inline choice for top-N ranked categories.
* If the chart needs custom annotations, dense long-label art direction, multi-panel layout, or presentation styling, use the shell graphics path instead of `Show_Chart`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.govtribe.com/user-guide/mcp/tools/show-chart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
