mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
54 lines
1.9 KiB
Markdown
54 lines
1.9 KiB
Markdown
---
|
|
description: "Buat grafik batang, garis, atau lingkaran dari data CSV atau JSON."
|
|
i18n_source_hash: d3c39384457b
|
|
i18n_provenance: human
|
|
i18n_output_hash: d6e29322db52
|
|
---
|
|
|
|
# Chart Maker {#chart-maker}
|
|
|
|
Buat grafik batang, garis, atau lingkaran dari data CSV atau JSON. Mengembalikan gambar PNG dari grafik yang dirender.
|
|
|
|
## API Endpoint {#api-endpoint}
|
|
|
|
`POST /api/v1/tools/files/chart-maker`
|
|
|
|
Menerima multipart form data berisi file CSV atau JSON dan field JSON `settings`.
|
|
|
|
## Parameters {#parameters}
|
|
|
|
| Parameter | Type | Required | Default | Description |
|
|
|-----------|------|----------|---------|-------------|
|
|
| kind | string | No | `"bar"` | Jenis grafik: `bar`, `line`, `pie` |
|
|
| title | string | No | - | Judul grafik (maks 120 karakter) |
|
|
| width | integer | No | `960` | Lebar grafik dalam piksel (320-2048) |
|
|
| height | integer | No | `540` | Tinggi grafik dalam piksel (240-1536) |
|
|
|
|
## Example Request {#example-request}
|
|
|
|
```bash
|
|
curl -X POST http://localhost:1349/api/v1/tools/files/chart-maker \
|
|
-H "Authorization: Bearer si_your-api-key" \
|
|
-F "file=@sales.csv" \
|
|
-F 'settings={"kind": "line", "title": "Monthly Sales", "width": 960, "height": 540}'
|
|
```
|
|
|
|
## Example Response {#example-response}
|
|
|
|
```json
|
|
{
|
|
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/sales_chart.png",
|
|
"originalSize": 1024,
|
|
"processedSize": 48500
|
|
}
|
|
```
|
|
|
|
## Notes {#notes}
|
|
|
|
- Input harus berupa file `.csv` atau `.json`. File CSV sebaiknya memiliki baris header dengan nama kolom.
|
|
- Kolom pertama digunakan sebagai label kategori; kolom kedua harus numerik dan menyediakan nilai data. Hanya dua kolom yang digunakan.
|
|
- Input JSON harus berupa array objek `{label, value}`, atau objek biasa yang key-nya menjadi label dan value-nya menjadi titik data.
|
|
- Maksimum 100 titik data. Semua nilai harus nol atau lebih besar.
|
|
- Output selalu berupa gambar PNG terlepas dari format input.
|