Plus plan

Chart from a Request

Draw a chart by describing it in words
POST
/v1/ai/documents/chart

About this tool

You add a data file such as a spreadsheet and describe the chart you want. AI picks the columns and the kind of chart, the numbers are calculated from your data, and the chart is drawn for you. You can pick the chart type, a light or dark look, and the width. The text is written by AI, so read it before you use it.
For example, you add a sales sheet and type: show total sales per month as a bar chart.

How to use it

  1. Choose this tool.
  2. Add your data file (up to 3), such as a spreadsheet or CSV.
  3. Describe the chart you want, and choose the type and look.
  4. Press Generate.
  5. Download the chart picture.

What you get back

You get a chart as a picture (PNG or SVG) that you can download.
TEST IT LIVE

Try Chart from a Request in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/documents/chart
Tool ID
ai.documents.chart
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/documents/chart" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'instructions=example' \
  -F 'quality=standard'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.documents.chart({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "instructions": "example",
    "quality": "standard"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->documents()->chart([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'instructions' => 'example',
    'quality' => 'standard',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Describe the chart you want in words; the model picks type and columns (and a SQL summary), code runs the SQL and draws the chart as PNG or SVG. Readiness: unbenchmarked (see GET /v1/ai/capabilities/documents.chart).

Classification: hybrid. Deterministic stages: table files read into real tables, SQL run on the data (SELECT only), columns checked against the data, chart drawn with Vega-Lite.

Chart from a Request works from text and settings, so no file is needed. The required inputs are instructions.

Not on the Free plan: Chart from a Request is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/documents/chart with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.