Chart
Render query results as line, bar, pie, scatter, and histogram PNG charts with JFreeChart
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/chart/index.md to help me query Chart with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Turn SQL rows into a bar chart
The connector returns a PNG image built from the sample sales rows.
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT png
FROM chart.main.chart_bar(
(SELECT * FROM (VALUES
('Q1', 30), ('Q2', 45), ('Q3', 38), ('Q4', 60)
) AS sales(quarter, revenue)),
category := 'quarter', value := 'revenue'
);

Quick start
Choose where to run Chart, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'chart' AS chart (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-chart:0.5.0'
);
3. Run a query
SELECT png
FROM chart.main.chart_bar(
(SELECT * FROM (VALUES
('Q1', 30), ('Q2', 45), ('Q3', 38), ('Q4', 60)
) AS sales(quarter, revenue)),
category := 'quarter', value := 'revenue'
);
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'chart' AS chart
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT png
FROM chart.main.chart_bar(
(SELECT * FROM (VALUES
('Q1', 30), ('Q2', 45), ('Q3', 38), ('Q4', 60)
) AS sales(quarter, revenue)),
category := 'quarter', value := 'revenue'
);
Query Farm operates Chart for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use chart as the catalog alias for the query below.
4. Run a query
SELECT png
FROM chart.main.chart_bar(
(SELECT * FROM (VALUES
('Q1', 30), ('Q2', 45), ('Q3', 38), ('Q4', 60)
) AS sales(quarter, revenue)),
category := 'quarter', value := 'revenue'
);
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'chart' AS chart (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-chart:0.5.0'
);
Overview
Render charts (line/bar/pie/scatter/histogram) from a query result into PNG image BLOBs via JFreeChart
Turn any DuckDB query into a publication-ready chart — line, bar, pie, scatter, or histogram — rendered to a PNG image BLOB entirely in SQL, with no plotting notebook, BI tool, or external service.
The chart extension lets you visualize query results where the data already lives. Point a chart function at a relation, name the columns to plot, and get back a single PNG ready to write to disk, embed in a report, attach to an email, or stream to a web response. It is built for data engineers, analysts, and automation pipelines that need data visualization as a first-class SQL operation — dashboards generated on a schedule, charts pasted into Markdown or HTML, and image artifacts produced straight from an ETL job, all without leaving the database.
Charts are rendered by JFreeChart, the mature, widely deployed Java charting library, running fully headless through java.awt so no display or windowing system is required. Every function follows the same table-in / table-out shape: it consumes the input relation as a table-valued first argument, accumulates the rows, draws the chart, and rasterizes it to PNG bytes. The result comes back as a single (png BLOB) row, so the rendered image flows through the rest of your SQL like any other value and can be saved with DuckDB's COPY/file functions or returned directly to a caller.
The worker covers the everyday visualization needs — trends and relationships between numeric variables, comparisons of a measure across discrete categories, and the distribution of a single column — with a shared set of optional title, width, and height controls over the rendered output.
Learn more from the JFreeChart project homepage, the source code on GitHub, and the JFreeChart API documentation.
Catalog
Everything chart exposes once attached — read straight from the worker's
released build.
main 1 table · 5 functions
Chart-rendering functions that turn a query result into a PNG image BLOB (line, bar, pie, scatter, histogram).
Schema examples (5)
Render a line chart from inline points.
SELECT octet_length(png)
FROM chart.main.chart_line((SELECT * FROM (VALUES (1, 10), (2, 25), (3, 18)) AS t(x, y)), x := 'x', y := 'y');
Render a bar chart of category counts.
SELECT octet_length(png)
FROM chart.main.chart_bar((SELECT * FROM (VALUES ('A', 30), ('B', 45)) AS t(category, value)), category := 'category', value := 'value');
Render a pie chart of two slices.
SELECT octet_length(png)
FROM chart.main.chart_pie((SELECT * FROM (VALUES ('X', 65), ('Y', 35)) AS t(label, value)), label := 'label', value := 'value');
Render a scatter plot of numeric x/y points.
SELECT octet_length(png)
FROM chart.main.chart_scatter((SELECT * FROM (VALUES (1.0, 2.1), (2.0, 3.9)) AS t(x, y)), x := 'x', y := 'y');
1 more example
Render a 5-bin histogram of a numeric column.
SELECT octet_length(png)
FROM chart.main.chart_histogram((SELECT * FROM (VALUES (1.0), (1.5), (2.0)) AS t(value)), value := 'value', bins := 5);
chart_types
One row per chart function this worker exposes, with its category, a one-line summary, and the column arguments it takes.
List every chart type this worker offers with its category and the column arguments it takes.
SELECT chart_type, category, column_arguments
FROM chart.main.chart_types()
ORDER BY chart_type;
Find the chart types that compare a measure across discrete categories.
SELECT chart_type, summary
FROM chart.main.chart_types()
WHERE category = 'categorical-comparisons'
ORDER BY chart_type;
SELECT chart_type, category
FROM chart.main.chart_types()
ORDER BY chart_type;
chart_bar (input TABLE, category := VARCHAR, value := VARCHAR, series := VARCHAR, title := VARCHAR, width := BIGINT, height := BIGINT)
Render a bar chart from an input relation to a PNG image BLOB (JFreeChart). With a series column, bars are grouped per series value.
Render one bar per category and report the PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_bar((SELECT * FROM (VALUES ('A', 30), ('B', 45), ('C', 12)) AS t(category, value)), category := 'category', value := 'value', title := 'Counts');
Render grouped bars (one group per product series) of units by quarter.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_bar((SELECT * FROM (VALUES ('Q1', 30, 'Widget'), ('Q2', 42, 'Widget'), ('Q1', 18, 'Gadget'), ('Q2', 25, 'Gadget')) AS t(quarter, units, product)), category := 'quarter', value := 'units', series := 'product', title := 'Units per quarter by product');
chart_histogram (input TABLE, value := VARCHAR, bins := BIGINT, title := VARCHAR, width := BIGINT, height := BIGINT)
Render a histogram of a numeric column to a PNG image BLOB (JFreeChart), binning the values into bins equal-width buckets.
Bin five values into 5 equal-width buckets and report the PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_histogram((SELECT * FROM (VALUES (1.0), (1.5), (2.0), (2.0), (3.5)) AS t(value)), value := 'value', bins := 5, title := 'Distribution');
Render a 30-bucket histogram of request latency as a 900x500 PNG.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_histogram((SELECT * FROM (VALUES (12.0), (15.0), (15.0), (22.0), (30.0), (45.0), (9.0)) AS t(latency_ms)), value := 'latency_ms', bins := 30, title := 'Latency distribution', width := 900, height := 500);
chart_line (input TABLE, x := VARCHAR, y := VARCHAR, series := VARCHAR, title := VARCHAR, width := BIGINT, height := BIGINT)
Render a line chart from an input relation to a PNG image BLOB (JFreeChart). With a series column, one line per series value.
Render a single line over numeric x/y points and report the PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_line((SELECT * FROM (VALUES (1, 10), (2, 25), (3, 18), (4, 30)) AS t(x, y)), x := 'x', y := 'y', title := 'Trend');
Render one line per region (series) of revenue over months and report its PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_line((SELECT * FROM (VALUES ('Jan', 100, 'East'), ('Feb', 140, 'East'), ('Jan', 80, 'West'), ('Feb', 95, 'West')) AS t(month, revenue, region)), x := 'month', y := 'revenue', series := 'region', title := 'Revenue by region');
chart_pie (input TABLE, label := VARCHAR, value := VARCHAR, title := VARCHAR, width := BIGINT, height := BIGINT)
Render a pie chart from an input relation to a PNG image BLOB (JFreeChart). One slice per distinct label; duplicate labels are summed.
Render a pie with one slice per label and report the PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_pie((SELECT * FROM (VALUES ('Chrome', 65), ('Safari', 19), ('Firefox', 16)) AS t(label, value)), label := 'label', value := 'value', title := 'Browser share');
Render spend per category as a 700x700 pie (duplicate categories are summed).
SELECT octet_length(png) AS bytes
FROM chart.main.chart_pie((SELECT * FROM (VALUES ('Rent', 1200), ('Food', 450), ('Rent', 100), ('Travel', 300)) AS t(category, amount)), label := 'category', value := 'amount', title := 'Spend by category', width := 700, height := 700);
chart_scatter (input TABLE, x := VARCHAR, y := VARCHAR, series := VARCHAR, title := VARCHAR, width := BIGINT, height := BIGINT)
Render a scatter plot from an input relation to a PNG image BLOB (JFreeChart). With a series column, one point series per series value.
Render a scatter plot of numeric x/y points and report the PNG byte size.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_scatter((SELECT * FROM (VALUES (1.0, 2.1), (2.0, 3.9), (3.0, 6.2)) AS t(x, y)), x := 'x', y := 'y', title := 'x vs y');
Render one colored point series per cohort of height against weight.
SELECT octet_length(png) AS bytes
FROM chart.main.chart_scatter((SELECT * FROM (VALUES (170.0, 65.0, 'A'), (180.0, 80.0, 'A'), (160.0, 55.0, 'B'), (175.0, 72.0, 'B')) AS t(height_cm, weight_kg, cohort)), x := 'height_cm', y := 'weight_kg', series := 'cohort', title := 'Height vs weight by cohort');
Try these queries
Render a line chart from inline points.
SELECT octet_length(png)
FROM chart.main.chart_line((SELECT * FROM (VALUES (1, 10), (2, 25), (3, 18)) AS t(x, y)), x := 'x', y := 'y')
Uses chart_line
Render a bar chart of category counts.
SELECT octet_length(png)
FROM chart.main.chart_bar((SELECT * FROM (VALUES ('A', 30), ('B', 45)) AS t(category, value)), category := 'category', value := 'value')
Uses chart_bar
Render a pie chart of two slices.
SELECT octet_length(png)
FROM chart.main.chart_pie((SELECT * FROM (VALUES ('X', 65), ('Y', 35)) AS t(label, value)), label := 'label', value := 'value')
Uses chart_pie
Render a scatter plot of numeric x/y points.
SELECT octet_length(png)
FROM chart.main.chart_scatter((SELECT * FROM (VALUES (1.0, 2.1), (2.0, 3.9)) AS t(x, y)), x := 'x', y := 'y')
Uses chart_scatter
Render a 5-bin histogram of a numeric column.
SELECT octet_length(png)
FROM chart.main.chart_histogram((SELECT * FROM (VALUES (1.0), (1.5), (2.0)) AS t(value)), value := 'value', bins := 5)
Uses chart_histogram
List every chart type this worker offers with its category and the column arguments it takes.
SELECT chart_type, category, column_arguments
FROM chart.main.chart_types()
ORDER BY chart_type
12 more examples in the Catalog, each listed under the table or function it uses.
Chart is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
Barcode
Documents & media
Read barcodes and QR codes from images, identify their symbology, and generate new ones as PNGs
Image
Documents & media
Decode images, read EXIF and GPS tags, spot near-duplicates by perceptual hash, and make thumbnails
Documents & media
Pull tables, words with their positions, page geometry, form fields and metadata out of PDFs, and render pages to PNG