Skip to content

feat: enhance site visualization options and themes - #434

Merged
hustcc merged 9 commits into
aifrom
chore/site-json
Sep 7, 2026
Merged

feat: enhance site visualization options and themes#434
hustcc merged 9 commits into
aifrom
chore/site-json

Conversation

@interstellarmt

Copy link
Copy Markdown
Member

Summary

This PR improves GPT-Vis chart presentation and updates the website to support both JSON and DSL examples.

Changes

JSON and DSL examples

  • Add support for displaying multiple code variants in the visualization wrapper.
  • Add compact Chart, JSON, and DSL preview tabs.
  • Store runnable JSON beside the DSL source for every website example.
  • Add automated consistency checks between JSON and parsed DSL configurations.
  • Support object-based Summary configurations.
  • Keep JSON and DSL available in the rendered website content for future SEO improvements.

Theme preview

  • Add built-in Default, Dark, and Academy theme controls to chart previews.
  • Add Light and Dark controls for Summary previews.
  • Switch chart themes without modifying the displayed example configuration.
  • Refine the preview toolbar layout and code presentation.

Chart presentation

  • Limit generated decimal precision to six places.
  • Add crosshair axis labels to Dual Axes charts and place the line-scale label on the right Y-axis.
  • Add examples covering shared crosshairs, dense axis labels, category highlighting, and point focus.

Funnel documentation

  • Document and test the locale and conversionRateLabel options.
  • Add a localized Funnel example in both JSON and DSL.

Copilot AI lite review requested due to automatic review settings September 3, 2026 12:35
@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6086716

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✅ Preview is ready!

PR preview ✅ Ready ✅ Ready
🔗 Preview https://antvis-GPT-Vis-preview-pr-434.surge.sh
📝 Commit6086716
⏱️ Build time0.01s
📦 Size8.8 MB (-1.2 KB ⬇️) · 181 files
🪵 LogsView logs
📱 MobileScan to open preview on mobile

↩️ Previous: ⚡️ 6086716 · antvis-GPT-Vis-preview-pr-434.surge.sh (open ↗) · 2026-09-07 03:42:04 UTC

🤖 Powered by surge-preview

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new tests include a TypeScript typing error in the crosshair mock and likely introduce a root-level test dependency on site-only packages (lucide-react) that can break pnpm test at the repo root.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR enhances GPT-Vis preview/presentation capabilities by adding multi-variant code display (JSON + DSL) and theme switching in the wrapper/site previews, while refining crosshair axis labels (precision + dual-axes right-Y alignment) and extending Funnel localization documentation/testing.

Changes:

  • Add wrapper support for multiple code variants and theme switching; update site previews to pass both DSL and runnable JSON.
  • Improve chart presentation: crosshair axis labels (precision + correct Y-scale/position for dual-axes) and updated theme tokens.
  • Add Funnel locale / conversionRateLabel docs plus parser test coverage, and add automated JSON↔DSL consistency checks for site examples.
File summaries
File Description
src/vis/summary/index.ts Allow Summary to render from either DSL string or { content, theme } object config.
src/vis/funnel/README.md Document locale and conversionRateLabel and add a localized DSL example.
src/vis/dual-axes/index.ts Bind crosshair axis labels to the line series and place Y label on the right axis; ensure cleanup on rerender/destroy.
src/vis-wrapper/styles.ts Redesign wrapper toolbar/tab styles, add responsive and reduced-motion rules.
src/vis-wrapper/index.ts Add code-variant navigation, code panel rendering via <pre><code>, and theme switcher wiring.
src/util/tokens.ts Refine axis token colors for light/dark themes.
src/util/theme.ts Adjust axis styling defaults (grid widths/dashes) and normalize theme mapping.
src/util/crosshair-axis-labels.ts Add decimal precision limiting, better formatter handling, and support selecting Y-scale by field + right-axis label placement.
src/types/index.ts Introduce VisualizationCodeVariant and extend options with codeVariants / themeOptions.
src/index.ts Export new public types (VisualizationCodeVariant, SummaryObjectConfig).
src/gpt-vis/index.ts Persist source config + preview theme; normalize requested theme for summary vs charts; pass code/theme options to wrapper and rerender on theme changes.
site/app/examples/page.tsx Update gallery to pass both dsl and json into previews.
site/app/examples/examplesData/wordcloud.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/waterfall-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/venn-diagram.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/treemap.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/table.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/summary.ts Store Summary DSL + runnable JSON object form for gallery and examples.
site/app/examples/examplesData/sankey-diagram.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/radar-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/pie-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/organization-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/network-graph.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/mindmap.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/liquid-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/indented-tree.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/funnel-chart.ts Store galleryDsl + runnable galleryJson, add locale/conversionRateLabel to docs and new localized example pair.
site/app/examples/examplesData/flow-diagram.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/fishbone-diagram.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/dual-axes.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs and updated description for crosshair labels.
site/app/examples/examplesData/column-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs and new dense-label example pair.
site/app/examples/examplesData/bar-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/examplesData/area-chart.ts Store galleryDsl + runnable galleryJson, plus per-example dsl/json pairs.
site/app/examples/[chart]/page.tsx Update docs pages to pass dsl + json into wrapper previews.
site/app/docs/page.tsx Update theme/custom palette preview snippets to use dsl prop.
site/app/components/ChartPreview.tsx Accept both dsl and json, pass code variants + theme options into GPTVis wrapper previews.
site/app/components/Carousel/index.tsx Update carousel previews to use dsl prop.
tests/site-examples.test.ts Add consistency checks to ensure each site DSL example has equivalent runnable JSON.
tests/funnel.test.ts Add parser coverage for Funnel locale and conversionRateLabel.
tests/crosshair-axis-labels.test.ts Add unit tests for crosshair label precision and right-Y placement behavior.
Review details
  • Files reviewed: 45/45 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread __tests__/crosshair-axis-labels.test.ts
Comment on lines +1 to +3
import { describe, expect, it } from 'vitest';
import { groupedExamplesData } from '../site/app/examples/examplesData';
import { isVisSyntax, parse } from '../src/syntax/parser';
@hustcc

hustcc commented Sep 3, 2026

Copy link
Copy Markdown
Member

readme 和 skill 也需要更新

Comment thread src/vis-wrapper/index.ts Outdated
Comment thread src/vis/summary/index.ts Outdated
Comment thread src/gpt-vis/index.ts Outdated
};

return <div ref={wrapperRef} className={`w-full min-h-[200px] ${className}`} style={style} />;
return (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里什么会变复杂?理论上时使用 gpt-vis 的 wrapper = true 就可以了。

Comment thread src/vis/funnel/index.ts
@hustcc
hustcc merged commit 6b76d58 into ai Sep 7, 2026
8 checks passed
@hustcc
hustcc deleted the chore/site-json branch September 7, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants