Charts
SlideSpeak supports bar, line, pie, and doughnut charts. Create charts
automatically with the /generate endpoint or manually with full control using
/generate/slide-by-slide.
SlideSpeak supports the following chart types:
- BAR - Vertical bar chart for comparing values across categories
- STACKED_BAR - Stacked column chart for showing how sub-categories contribute within each bar
- HORIZONTAL_BAR - Horizontal bar chart for comparing values
- LINE - Line chart for showing trends over time
- PIE - Pie chart for showing proportions of a whole
- DOUGHNUT - Doughnut chart (pie chart with a hole in the center)
Using Charts with /generate
Section titled “Using Charts with /generate”The /generate endpoint can automatically generate charts from your content.
Simply provide textual or numerical data in your prompt, and if the AI detects
that a chart would be an effective way to present the information, it will
automatically create one.
Example: Automatic Chart Generation
Section titled “Example: Automatic Chart Generation”curl -X POST https://api.slidespeak.co/api/v1/presentation/generate -H "Content-Type: application/json" -H "X-API-Key: <YOUR_API_KEY>" -d '{ "plain_text": "Create a presentation about our company performance. Our revenue for 2024 was: Q1: $45,000, Q2: $52,000, Q3: $61,000, Q4: $58,000. Show this data in a chart to visualize our quarterly performance.", "template": "DEFAULT", "length": 3 }'const requestBody = { plain_text: 'Create a presentation about our company performance. Our revenue for 2024 was: Q1: $45,000, Q2: $52,000, Q3: $61,000, Q4: $58,000. Show this data in a chart to visualize our quarterly performance.', template: 'DEFAULT', length: 3};
fetch('https://api.slidespeak.co/api/v1/presentation/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': '<YOUR_API_KEY>' }, body: JSON.stringify(requestBody)}) .then(response => { return response.json(); }) .then(data => { console.log('Response:', data); }) .catch(error => { console.error('Error:', error); });import requests
url = "https://api.slidespeak.co/api/v1/presentation/generate"headers = { "Content-Type": "application/json", "X-API-Key": "<YOUR_API_KEY>"}payload = { "plain_text": "Create a presentation about our company performance. Our revenue for 2024 was: Q1: $45,000, Q2: $52,000, Q3: $61,000, Q4: $58,000. Show this data in a chart to visualize our quarterly performance.", "template": "DEFAULT", "length": 3}
response = requests.post(url, headers=headers, json=payload)print(response.json())<?phprequire 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$headers = [ 'Content-Type' => 'application/json', 'X-API-Key' => '<YOUR_API_KEY>'];
$payload = [ "plain_text" => "Create a presentation about our company performance. Our revenue for 2024 was: Q1: $45,000, Q2: $52,000, Q3: $61,000, Q4: $58,000. Show this data in a chart to visualize our quarterly performance.", "template" => "DEFAULT", "length" => 3];
$response = $client->post('https://api.slidespeak.co/api/v1/presentation/generate', $payload);
$body = $response->getBody();$data = json_decode($body, true);
print_r($data);?>Using Charts with /generate/slide-by-slide
Section titled “Using Charts with /generate/slide-by-slide”The /generate/slide-by-slide endpoint gives you full control over chart
structure. You can specify the exact data, labels, and styling for your charts.
Chart Structure
Section titled “Chart Structure”When using the slide-by-slide endpoint, each chart slide must include:
- layout - Must be set to
CHART - title - The title of the slide
- item_amount - Should be set to
0for chart slides - content - A description of the chart (used only if
chartis not provided; the AI will generate a chart from this text) - chart - The chart object (see structure below). If omitted, a chart will be automatically generated from the
contentfield
The chart object has the following structure:
{ "type": "BAR | STACKED_BAR | HORIZONTAL_BAR | LINE | PIE | DOUGHNUT", "name": "Chart Title", "data": { "labels": ["Label1", "Label2", "Label3"], // x-axis labels or pie slice labels "datasets": [ { "label": "Dataset Name", // series name (appears in legend) "data": [10, 20, 30] // numeric values (must match labels length) } ], "xAxisLabel": "X-Axis Label", // empty string for pie/doughnut charts "yAxisLabel": "Y-Axis Label" // empty string for pie/doughnut charts }}Example: Bar Chart
Section titled “Example: Bar Chart”curl -X POST https://api.slidespeak.co/api/v1/presentation/generate/slide-by-slide -H "Content-Type: application/json" -H "X-API-Key: <YOUR_API_KEY>" -d '{ "template": "DEFAULT", "slides": [ { "title": "Quarterly Revenue", "layout": "CHART", "item_amount": 0, "content": "Revenue performance across quarters", "chart": { "type": "BAR", "name": "Quarterly Revenue", "data": { "datasets": [ { "label": "Revenue", "data": [45000, 52000, 61000, 58000] } ], "labels": ["Q1", "Q2", "Q3", "Q4"], "xAxisLabel": "Quarter", "yAxisLabel": "Revenue ($)" } } } ] }'const requestBody = { template: 'DEFAULT', slides: [ { title: 'Quarterly Revenue', layout: 'CHART', item_amount: 0, content: 'Revenue performance across quarters', chart: { type: 'BAR', name: 'Quarterly Revenue', data: { datasets: [ { label: 'Revenue', data: [45000, 52000, 61000, 58000] } ], labels: ['Q1', 'Q2', 'Q3', 'Q4'], xAxisLabel: 'Quarter', yAxisLabel: 'Revenue ($)' } } } ]};
fetch('https://api.slidespeak.co/api/v1/presentation/generate/slide-by-slide', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': '<YOUR_API_KEY>' }, body: JSON.stringify(requestBody)}) .then(response => { return response.json(); }) .then(data => { console.log('Response:', data); }) .catch(error => { console.error('Error:', error); });import requests
url = "https://api.slidespeak.co/api/v1/presentation/generate/slide-by-slide"headers = { "Content-Type": "application/json", "X-API-Key": "<YOUR_API_KEY>"}payload = { "template": "DEFAULT", "slides": [ { "title": "Quarterly Revenue", "layout": "CHART", "item_amount": 0, "content": "Revenue performance across quarters", "chart": { "type": "BAR", "name": "Quarterly Revenue", "data": { "datasets": [ { "label": "Revenue", "data": [45000, 52000, 61000, 58000] } ], "labels": ["Q1", "Q2", "Q3", "Q4"], "xAxisLabel": "Quarter", "yAxisLabel": "Revenue ($)" } } } ]}
response = requests.post(url, headers=headers, json=payload)print(response.json())<?phprequire 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$headers = [ 'Content-Type' => 'application/json', 'X-API-Key' => '<YOUR_API_KEY>'];
$payload = [ "template" => "DEFAULT", "slides" => [ [ "title" => "Quarterly Revenue", "layout" => "CHART", "item_amount" => 0, "content" => "Revenue performance across quarters", "chart" => [ "type" => "BAR", "name" => "Quarterly Revenue", "data" => [ "datasets" => [ [ "label" => "Revenue", "data" => [45000, 52000, 61000, 58000] ] ], "labels" => ["Q1", "Q2", "Q3", "Q4"], "xAxisLabel" => "Quarter", "yAxisLabel" => "Revenue ($)" ] ] ] ]];
$response = $client->post('https://api.slidespeak.co/api/v1/presentation/generate/slide-by-slide', $payload);
$body = $response->getBody();$data = json_decode($body, true);
print_r($data);?>Best Practices
Section titled “Best Practices”Choosing the Right Chart Type
Section titled “Choosing the Right Chart Type”- Bar/Horizontal Bar Charts - Best for comparing values across different categories
- Stacked Bar Charts - Ideal when you want to compare both category totals and how smaller segments contribute to each total
- Line Charts - Ideal for showing trends and changes over time
- Pie/Doughnut Charts - Perfect for showing proportions and percentages of a whole
Data Guidelines
Section titled “Data Guidelines”- Keep datasets clear and focused - avoid overcrowding charts with too many data points
- Use descriptive labels that clearly identify what each data point represents
- Provide meaningful axis labels to help your audience understand the scale and units
- For pie/doughnut charts, limit the number of segments to 5-7 for better readability
Multiple Datasets
Section titled “Multiple Datasets”You can include multiple datasets in bar and line charts to compare different series of data. Each dataset should have:
- A unique, descriptive label
- The same number of data points as there are labels