---
title: Get Chart SVG
description: Get chart rendered as SVG
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-svg
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-svg.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Retrieve a pre-rendered chart as an SVG image, ready for embedding in HTML or documents.

## Get Chart SVG - Query Structure

```graphql
query GetChartSvg($input: GetChartSvgInput!) {
  getChartSvg(input: $input) {
    svg
  }
}
```

## Variables

The query takes a single `input` object of type `GetChartSvgInput`:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `term_id` | `String` | Yes | Term ID to generate chart for |
| `curve_id` | `String` | Yes | Curve ID (bonding curve) |
| `interval` | `String` | Yes | Time interval (e.g. `"1h"`, `"1d"`) |
| `start_time` | `String` | Yes | Start of time range (ISO 8601) |
| `end_time` | `String` | Yes | End of time range (ISO 8601) |
| `graph_type` | `String` | No | Type of graph data |
| `width` | `Int` | No | Chart width in pixels |
| `height` | `Int` | No | Chart height in pixels |
| `background_color` | `String` | No | Background color (e.g. `"#1a1a2e"`) |
| `line_color` | `String` | No | Line color (e.g. `"#00ff00"`) |

```json
{
  "input": {
    "term_id": "0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769",
    "curve_id": "1",
    "interval": "1d",
    "start_time": "2024-01-01T00:00:00Z",
    "end_time": "2024-01-31T23:59:59Z",
    "width": 800,
    "height": 400
  }
}
```

## Response Fields (`ChartSvgOutput`)

| Field | Type | Description |
|-------|------|-------------|
| `svg` | `String!` | SVG markup string |

## Expected Response

```json
{
  "data": {
    "getChartSvg": {
      "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"800\" height=\"400\">...</svg>"
    }
  }
}
```

## Interactive Example

    id: 'chart-svg',
    title: 'Chart SVG',
    query: `query GetChartSvg($input: GetChartSvgInput!) {
  getChartSvg(input: $input) {
    svg

}`,
    variables: {
      input: {
        term_id: '0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769',
        curve_id: '1',
        interval: '1d',
        start_time: '2024-01-01T00:00:00Z',
        end_time: '2024-01-31T23:59:59Z',
        width: 800,
        height: 400

];

## Use Cases

### Direct HTML Embedding

```typescript
async function displayChart(termId: string, curveId: string, containerId: string) {
  const query = `
    query GetChartSvg($input: GetChartSvgInput!) {
      getChartSvg(input: $input) {
        svg
      }
    }
  `

  const endTime = new Date()
  const startTime = new Date()
  startTime.setDate(startTime.getDate() - 30)

  const response = await client.request(query, {
    input: {
      term_id: termId,
      curve_id: curveId,
      interval: '1d',
      start_time: startTime.toISOString(),
      end_time: endTime.toISOString(),
      width: 600,
      height: 300
    }
  })

  document.getElementById(containerId).innerHTML = response.getChartSvg.svg
}
```

## Related

- [Chart Raw SVG](https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-raw-svg) - Minimal SVG output
- [Chart JSON](https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-json) - JSON data for custom rendering
