Skip to main content

Chart Operations

The Intuition GraphQL API provides chart generation operations to create visualizations of protocol data. These operations return chart data in either JSON or SVG format for flexible integration.

Available Operations​

OperationDescription
getChartJsonGet chart data as structured JSON
getChartRawJsonGet raw chart JSON data
getChartSvgGet chart rendered as SVG
getChartRawSvgGet raw SVG chart data

Use Cases​

Dashboard Integration​

Embed generated charts directly in dashboards:

  • SVG format for direct rendering
  • JSON format for custom chart libraries

Data Export​

Export chart data for external tools:

  • JSON for data processing
  • SVG for reports and documents

Performance Analytics​

Generate performance visualizations:

  • Price history charts
  • Volume trends
  • Position performance

Quick Start​

import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'

const client = new GraphQLClient(API_URL_PROD)

// Get chart as SVG
const query = `
query GetChartSvg($input: ChartInput!) {
getChartSvg(input: $input)
}
`

const svg = await client.request(query, {
input: {
type: 'PRICE_HISTORY',
term_id: '0x...',
interval: 'DAY',
width: 800,
height: 400
}
})

// Render SVG directly
document.getElementById('chart').innerHTML = svg.getChartSvg

Chart Types​

TypeDescription
PRICE_HISTORYHistorical price chart for a term
VOLUMETrading volume over time
TVLTotal Value Locked history
POSITIONSPosition distribution chart