GeezerVison is showing github.com — feat(chartquery): add ChartQuery integration by josselinlbe · Pull Request #9890 · simstudioai/sim
Conversation
Summary
Adds a ChartQuery integration: tools, block, icon and generated docs page. I work on ChartQuery, so this PR comes from the ChartQuery team.
Turn data into images with ChartQuery: render any Chart.js v4 chart from its config, describe a chart in plain language and let ChartQuery build it from your data, or generate QR codes and barcodes. Every operation stores the image and returns public links you can put in a message, an email or a document.
Operations:
- Create Chart (
chartquery_create_chart): Render a Chart.js v4 chart (bar, line, pie, doughnut, radar, scatter and more) from its config and get public links to the image.
- Create Chart From Prompt (
chartquery_create_chart_from_prompt): Describe a chart in plain language, optionally with raw CSV or JSON data, and get public links to the image ChartQuery builds from it.
- Create QR Code (
chartquery_create_qr_code): Generate a QR code for a URL, text, email, phone number or Wi-Fi network and get public links to the image.
- Create Barcode (
chartquery_create_barcode): Generate a barcode (Code 128, EAN-13, UPC-A, ITF-14, Code 39 and more) and get public links to the image.
Every tool sends share: true, so the API answers with JSON links (render_url, view_url, an embed snippet and the expiry) instead of binary image data, which keeps outputs usable by later blocks. Credentials are a ChartQuery API key on the block (AuthMode.ApiKey), sent as the x-api-key header. Every tool is an external ToolConfig.request (POST with a JSON body) against the ChartQuery API. The chart config accepts an object or a JSON string, and the block's code field has a wand that writes a Chart.js config from a description.
Product update (if relevant)
Sim has no chart, QR code or barcode integration today. Workflows can now post a chart of table data to Slack, attach a QR code to an email, or write barcode images back to a product table. The block appears in the integrations catalog under Analytics with 4 templates and grounded skills; the docs page is apps/docs/content/docs/integrations/chartquery.mdx.
Type of Change
- Bug fix
- New feature
- Breaking change
- Documentation
- Other: ___________
Testing
- Request bodies and outputs follow the documented OpenAPI request schemas and
share: true response of each endpoint. The same endpoints returned share links in live calls from our other integrations; these Sim tools have not been run live from a Sim instance yet.
- Local gate on this branch:
bun run lint, bun run type-check, bun run check:audits (all 62 audits), bun run apps/sim/scripts/check-canvas-sentences.ts --block=chartquery, and the blocks Vitest suites (85 files, 795 tests) pass. check-block-registry.ts origin/staging could not run locally because my install skipped lifecycle scripts (node_modules/simstudio-ts-sdk missing); the block is new, so no existing subblock id changes.
- Regenerated artifacts are committed: tool metadata, docs, block names and the docs manifest.
- No new unit tests, following the repo's testing guidance.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Screenshots/Videos
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
greptile-apps[bot] reacted with thumbs up emoji
Adds ChartQuery tools, block, icon and generated docs: render a Chart.js v4 chart from its config, build a chart from a plain-language description, and create QR codes and barcodes. Every tool asks for share links so the output is a public image URL.
|
Someone is attempting to deploy a commit to the Sim Team on Vercel.
A member of the Team first needs to authorize it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
 Confidence Score: 4/5
[Medium impact] The new behavior is limited to workflows that choose ChartQuery.
The PR appears safe to merge, with a non-blocking issue that changes surrounding spaces in encoded text.
Findings
Encoded text loses spaces ▶
Summary
Adds ChartQuery with four operations for charts, charts from prompts, QR codes, and barcodes.
- ChartQuery actions turn chart and code inputs into shareable image links.
- The ChartQuery block gives workflows four ways to make images.
- ChartQuery appears in Sim’s integration catalog and docs.
josselinlbe explicitly states that no new unit tests were added, following the repository's testing guidance.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[ChartQuery block] --> B[Selected tool]
B --> C[Build JSON with share true]
C --> D[ChartQuery API]
D --> E[Map image links]
E --> F[Later workflow blocks]
Loading
Reviews (1) · Last reviewed commit: "feat(chartquery): add ChartQuery integra..." · Reviewed by Greptile
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
if (value === undefined || value === null) continue
|
|
|
if (typeof value === 'string' && value.trim() === '') continue
|
|
|
if (typeof value === 'number' && !Number.isFinite(value)) continue
|
|
|
body[key] = typeof value === 'string' ? value.trim() : value
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoded text loses spaces
chartQueryBody trims every string, including the data sent to QR code and barcode operations. Encoding " hello " sends "hello" instead, so the image contains a different value from the one supplied. Preserve payload strings as given; trim only fields where surrounding spaces are not meaningful.
|
body[key] = typeof value === 'string' ? value.trim() : value |
|
body[key] = value |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks. chartQueryBody no longer trims strings, so a QR code or barcode encodes the value exactly as given. It still leaves out unset optional values (undefined, null, empty string, non-finite numbers) so the API applies its defaults.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
greptile-apps[bot] reacted with thumbs up emoji
Do not trim request strings: spaces can be part of the value a QR code or barcode encodes. Unset optional values are still left out.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|