apex_add_sparkline
Add sparkline mini-charts with trend lines to Oracle APEX pages. Provide metric labels, SQL for current value, and trend SQL for up to 7 points.
Instructions
Add sparkline mini-charts with trend lines. Provide metrics list with sql + trend_sql.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| columns | No | Number of columns (2-4). | |
| metrics | Yes | List of metric dicts. Each dict: - "label": Card title (required) - "sql": SQL returning single current value (required) - "trend_sql": SQL returning up to 7 rows with VALUE column for sparkline. Example: "SELECT NR_PCT_TOTAL AS VALUE FROM TEA_AVALIACOES WHERE DS_STATUS='CONCLUIDA' ORDER BY DT_AVALIACAO DESC FETCH FIRST 7 ROWS ONLY" - "icon": Font Awesome icon class (e.g., "fa-chart-line") - "color": Hex color or named color for accent (e.g., "#00995D", "blue") - "suffix": Unit suffix (e.g., "%", "pts") - "prefix": Unit prefix (e.g., "$", "R$") | |
| page_id | Yes | Target page ID. | |
| sequence | No | Region display order. | |
| region_name | Yes | Region name. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |