Skip to content

feat(scatter): add --visualmap for 2D scatter gradient coloring#169

Merged
fahimfaisaal merged 6 commits into
mainfrom
feat/scatter-2d-visualmap
Jun 27, 2026
Merged

feat(scatter): add --visualmap for 2D scatter gradient coloring#169
fahimfaisaal merged 6 commits into
mainfrom
feat/scatter-2d-visualmap

Conversation

@fahimfaisaal

Copy link
Copy Markdown
Member

Summary

Adds opt-in gradient coloring for 2D scatter charts via --visualmap / visualMap config — separate from the existing --3d-visualmap path used by 3D charts.

  • CLI: vizb scatter data.csv --visualmap (off by default; scatter-only)
  • Color dimension: metric → off-chart z → y fallback
  • UI: new VisualMapControl toggle in settings (2D scatter only), URL param scatter.vm
  • Bridge: 3D scatter honors visualMap when threeDVisualMap is false

Changes

Area What
Go --visualmap flag, ScatterConfig.visualMap, scatter:visualmap chart spec
UI resolve2DScatterVisualMap, shared create3DVisualMap layout, value/grouped scatter wiring
Fix Register VisualMapComponent in ChartScatter.vue (tree-shaking)
Fix Align 2D visualMap layout with 3D (right: 0%, no extra grid padding)

Example

vizb scatter examples/csv/life-expectancy.csv \
  --select income,life_expectancy -o scatter.html --visualmap

Test plan

  • Go: config/charts/scatter, cmd/charts/scatter, shared chart_spec tests
  • UI: visualMap, scatter chart options, fieldRegistry, transform tests
  • Manual: open generated HTML, toggle visualMap in settings panel

Introduce opt-in --visualmap on vizb scatter (default off), separate from
--3d-visualmap. Wires CLI/config, settings toggle, URL param scatter.vm,
value-mode and grouped ECharts visualMap rendering, and transform support
for off-chart z / metric as the color dimension.
ECharts tree-shaking requires VisualMapComponent to be registered before
visualMap options take effect. ChartHeatmap and Chart3D already did this;
ChartScatter did not, so --visualmap produced options with no visible
gradient. Also map --visualmap onto 3D scatter coloring when auto-value
enables continuous 3D, and use dimension 1 for grouped scatter values.
Drop the extra 12% grid right margin and delegate 2D visualMap config to
create3DVisualMap so the gradient sits flush on the right like 3D charts.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.56522% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
shared/chart_spec.go 46.15% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

SettingsPanel.test.ts stubs .vue control imports because vitest runs
without the Vue plugin. Add the missing VisualMapControl mock and a
2D scatter field-selection case.
Value-mode charts hide the legend but still reserved 15% grid top for
legend space. Use a minimal 8px top band (same as heatmap) so 2D scatter
gets a taller plot area.
Merge origin/main (PR #166: --symbol / --symbol-size for line and scatter)
into feat/scatter-2d-visualmap, keeping both feature sets.

- Scatter CLI/config/chart_spec now support visualmap and symbol flags
- UI composables wire visualMap coloring alongside resolveSeriesSymbol
- Regenerated pkg/template/vizb-ui.gen.go after merge
@fahimfaisaal
fahimfaisaal merged commit 8d4ac77 into main Jun 27, 2026
13 checks passed
@fahimfaisaal
fahimfaisaal deleted the feat/scatter-2d-visualmap branch July 9, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants