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β
| Operation | Description |
|---|---|
getChartJson | Get chart data as structured JSON |
getChartRawJson | Get raw chart JSON data |
getChartSvg | Get chart rendered as SVG |
getChartRawSvg | Get 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β
| Type | Description |
|---|---|
PRICE_HISTORY | Historical price chart for a term |
VOLUME | Trading volume over time |
TVL | Total Value Locked history |
POSITIONS | Position distribution chart |
Related Documentationβ
- Chart JSON - JSON chart data
- Chart SVG - SVG chart rendering
- Time Series Queries - Raw time-series data