Skip to content

feat(cli): add title override for col-axis charts#245

Merged
fahimfaisaal merged 4 commits into
mainfrom
feat/col-axis-chart-title
Jul 23, 2026
Merged

feat(cli): add title override for col-axis charts#245
fahimfaisaal merged 4 commits into
mainfrom
feat/col-axis-chart-title

Conversation

@hfl0506

@hfl0506 hfl0506 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Closes #237

Changes

  • Added --title (no shorthand) for group + --col-axis
    charts.

  • Keeps -n as the dataset/page name; --title sets
    expanded stats[].type.

  • Successful col-axis output stays one chart; JSON
    emits the custom stat type.

  • Without --title, behavior is unchanged: empty type
    falls back to -n.

  • Unsupported uses warn once and do not alter existing
    types.

  • Multi-stat --select … (Title) behavior remains
    unchanged.

  • Added pipeline/flag tests and concurrency example
    documentation.

Test Result

# before test initial
task init
task lint:cli
task test:cli

Case 1

go run . bar examples/csv/concurrency.csv -g load -p y -A x \
          -n 'Q1 release' \
          --title 'Framework throughput' \
          -o /tmp/title.json
jq -r '.name, (.data[].stats[].type)' /tmp/title.json

# result
Q1 release
Framework throughput
Framework throughput
Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput                                     Framework throughput

Case 2

# Default remains unchanged: title falls back to -n;
  JSON type is null/omitted.
go run . bar examples/csv/concurrency.csv -g load -p y
  -A x \
    -n 'Q1 release' -o /tmp/default.json
  jq '[.data[].stats[].type] | unique' /tmp/default.json

# result
[
  null
]

Case 3

# No --col-axis: --title is ignored with one warning;
  column types stay distinct.
go run . bar examples/csv/concurrency.csv -g load -p y --title 'Ignored' -o /tmp/no-axis.json
jq -r '[.data[].stats[].type] | unique[]' /tmp/no-axis.json

# result
chi
default
echo                                                     
gin                                                      
goframe                                                  
httpz

Case 4

# Existing conflict remains fatal.
go run . bar examples/csv/concurrency.csv -g load -p x
  -A x -o /tmp/conflict.json

# result
{"timestamp":"2026-07-20T15:34:41Z","name":"Comparisons","theme":"default","axes":[{"key":"x"},{"key":"y","label":"load"}],"settings":[{"type":"bar","scale":"linear"}],"data":[{"xAxis":"default","yAxis":"100","stats":[{"value":3103.62}]},{"xAxis":"chi","yAxis":"100","stats":[{"value":3103.73}]},{"xAxis":"echo","yAxis":"100","stats":[{"value":3104.59}]},{"xAxis":"gin","yAxis":"100","stats":[{"value":3103.72}]},{"xAxis":"goframe","yAxis":"100","stats":[{"value":3114.2}]},{"xAxis":"httpz","yAxis":"100","stats":[{"value":3105.1}]},{"xAxis":"default","yAxis":"1000","stats":[{"value":32423.67}]},{"xAxis":"chi","yAxis":"1000","stats":[{"value":32421.28}]},{"xAxis":"echo","yAxis":"1000","stats":[{"value":32413.72}]},{"xAxis":"gin","yAxis":"1000","stats":[{"value":32408.85}]},{"xAxis":"goframe","yAxis":"1000","stats":[{"value":32411.78}]},{"xAxis":"httpz","yAxis":"1000","stats":[{"value":32413.1}]},{"xAxis":"default","yAxis":"5000","stats":[{"value":120057.1}]},{"xAxis":"chi","yAxis":"5000","stats":[{"value":111899.8}]},{"xAxis":"echo","yAxis":"5000","stats":[{"value":114180.37}]},{"xAxis":"gin","yAxis":"5000","stats":[{"value":114503.28}]},{"xAxis":"goframe","yAxis":"5000","stats":[{"value":108866.64}]},{"xAxis":"httpz","yAxis":"5000","stats":[{"value":113671.85}]}]}

Summary by CodeRabbit

  • New Features
    • Added a --title CLI option to control chart titles for eligible column-axis outputs.
    • Extended REST conversion with optional top-level title and structured grouping.colAxis, including updated conversion examples.
  • Bug Fixes
    • Ensure title flows through conversion correctly, including “applies” vs “ignored” warnings, and improved column-axis validation/behavior.
  • Documentation
    • Updated the CSV concurrency.csv example to document separate page and chart titles.
  • Tests
    • Added/expanded CLI, core, and REST tests covering title and colAxis behavior and validation paths.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 55d043aa-a3fd-48b1-b610-02266897ada1

📥 Commits

Reviewing files that changed from the base of the PR and between bceda1b and 1a810f4.

📒 Files selected for processing (2)
  • cmd/cli/pipeline_test.go
  • pkg/core/core.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/core/core.go
  • cmd/cli/pipeline_test.go

📝 Walkthrough

Walkthrough

The CLI and REST conversion paths accept an optional chart title, propagate it into core column-axis processing, apply it to single-chart statistics, and warn or reject unsupported configurations. API schemas, tests, and CSV documentation cover the new behavior.

Changes

Chart title override

Layer / File(s) Summary
Column-axis title application
pkg/core/core.go, pkg/core/core_test.go
Adds title-aware column-axis expansion, structured ignored-option errors, and core coverage for applied and invalid titles.
CLI title propagation and warnings
cmd/cli/dataflags.go, cmd/cli/flagbag.go, cmd/cli/flagbag_test.go, cmd/cli/pipeline.go, cmd/cli/pipeline_test.go
Adds --title, carries it through RunMeta and RunLinear, applies it to eligible statistics, and warns when unsupported.
REST contract and documentation
cmd/serve_contract.go, cmd/serve_test.go, api/openapi.yaml, api/openapi_test.go, examples/csv/README.md
Adds title and grouping.colAxis request support, validation paths, endpoint coverage, OpenAPI examples, and separate page/chart title documentation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CLIorREST
  participant ApplyColAxis
  participant Dataset
  Client->>CLIorREST: Provide title and column-axis options
  CLIorREST->>ApplyColAxis: Pass title with grouped data
  ApplyColAxis->>Dataset: Set expanded stat types
  ApplyColAxis-->>CLIorREST: Return transformed data or warning/error
Loading

Possibly related PRs

  • goptics/vizb#232: Introduced the REST conversion contract and endpoint that this PR extends with title and column-axis options.

Suggested reviewers: fahimfaisaal

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds REST/OpenAPI title and grouping.colAxis support, which is outside the linked CLI-only --title scope. Split the API/OpenAPI and server-contract updates into a separate PR unless they are explicitly required by the linked issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new CLI --title override for col-axis charts.
Linked Issues check ✅ Passed The PR adds --title, threads it through the pipeline, preserves -n, warns when ignored, and adds tests/docs, matching #237.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hfl0506
hfl0506 marked this pull request as ready for review July 20, 2026 15:44
@hfl0506
hfl0506 requested a review from fahimfaisaal as a code owner July 20, 2026 15:44
@hfl0506 hfl0506 added enhancement New feature or request cli Command line interface related tasks action vizb action.yml releated work labels Jul 20, 2026
@fahimfaisaal fahimfaisaal added this to the Release v0.17.0 milestone Jul 20, 2026
@hfl0506
hfl0506 force-pushed the feat/col-axis-chart-title branch from f2439e9 to 39854ab Compare July 21, 2026 01:35
@hfl0506

hfl0506 commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @fahimfaisaal can code rabbit enable again for review ? Thanks

@fahimfaisaal

Copy link
Copy Markdown
Member

@coderabbitai please review again

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

@fahimfaisaal, I’ll re-review all changes in #245.

✅ Action performed

Full review finished.

@fahimfaisaal fahimfaisaal left a comment

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.

@hfl0506 We need to change the API layer as well.

@fahimfaisaal fahimfaisaal added the api api related works label Jul 22, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/core/core.go`:
- Around line 222-224: Update the mode validation around IsSelectAxis and
IsMultiStat in the relevant configuration logic so multi-stat inputs with
--col-axis are rejected via the existing ignored-option warning/error and their
existing stat types remain unchanged; adjust the predicate accordingly. Add a
regression test covering --title combined with --col-axis in multi-stat mode,
verifying the warning/error and preserved stat types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1eef9e7-1abe-4480-9dc8-770184c7e643

📥 Commits

Reviewing files that changed from the base of the PR and between 98a2321 and bceda1b.

📒 Files selected for processing (7)
  • api/openapi.yaml
  • api/openapi_test.go
  • cmd/cli/pipeline.go
  • cmd/serve_contract.go
  • cmd/serve_test.go
  • pkg/core/core.go
  • pkg/core/core_test.go

Comment thread pkg/core/core.go Outdated
@hfl0506

hfl0506 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@hfl0506 We need to change the API layer as well.

Hi @fahimfaisaal I changed API layer accordingly. please take a look when you have a chance. Thanks

@fahimfaisaal fahimfaisaal left a comment

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.

Well Done

@fahimfaisaal
fahimfaisaal merged commit 3001474 into main Jul 23, 2026
14 checks passed
@fahimfaisaal
fahimfaisaal deleted the feat/col-axis-chart-title branch July 23, 2026 05:35
@fahimfaisaal

Copy link
Copy Markdown
Member

@hfl0506 We missed the action update. need to add new title prop at action.yml, could you create another PR for this missing part? thanks

@hfl0506

hfl0506 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@hfl0506 We missed the action update. need to add new title prop at action.yml, could you create another PR for this missing part? thanks

Yes. I can create another MR for the action change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action vizb action.yml releated work api api related works cli Command line interface related tasks enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat]: --title flag to override chart title for single-chart --col-axis

3 participants