tweak: support comparison in ai charts#8836
Merged
Conversation
ericpgreen2
approved these changes
Feb 17, 2026
Contributor
ericpgreen2
left a comment
There was a problem hiding this comment.
Clean, well-scoped PR. The comparison plumbing leverages the existing CartesianChartProvider infrastructure (dual measures with __prev suffix, Vega transforms) — no new rendering code needed. The prompt examples and validation logic are thorough.
Schema nit — add required to comparison_time_range object
charts_json_schema.go — The comparison_time_range object doesn't declare "required": ["start", "end"]. The Go handler validates this server-side so it won't cause a runtime bug, but having the schema match the actual contract helps the LLM produce correct output. Currently the schema would accept {"comparison_time_range": {}} as valid.
"comparison_time_range": {
"type": "object",
"properties": { ... },
"required": ["start", "end"],
"description": "..."
}Follow-ups (non-blocking):
- Explore link drops comparison —
ChartContainer.svelte:120hardcodesshowTimeComparison: false. Now that AI charts can have comparison, clicking "Open in Explore" loses it. Pre-existing but newly relevant. area_chartexclusion — Area usesCartesianChartProviderlike line/bar, so comparison likely works. If the exclusion is deliberate (overlapping fills?), a brief comment in the prompt explaining why would help the LLM avoid suggesting workarounds.- Evals — The create_chart prompt is getting rich enough that eval coverage would be valuable. Tests asserting the LLM produces valid specs for key patterns (comparison bar chart, invalid chart type + comparison rejected, etc.) would catch prompt regressions early.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add support for comparison time range in some the AI generated charts
Part of https://linear.app/rilldata/issue/APP-725/ai-improve-analyst-agents-visualization-logic
Checklist: