Skip to content

feat: add route and menu support for axis title properties#12517

Merged
kgryte merged 10 commits into
stdlib-js:refactor/plotfrom
gururaj1512:view-axis-title-_
Jun 5, 2026
Merged

feat: add route and menu support for axis title properties#12517
kgryte merged 10 commits into
stdlib-js:refactor/plotfrom
gururaj1512:view-axis-title-_

Conversation

@gururaj1512
Copy link
Copy Markdown
Member

Resolves None

Description

What is the purpose of this pull request?

This pull request:

  • feat: add route and menu support for axis title properties
Screen.Recording.2026-06-04.at.3.03.02.AM.mov

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 3, 2026
@kgryte kgryte added Feature Issue or pull request for adding a new feature. and removed Needs Review A pull request which needs code review. labels Jun 4, 2026

if ( startsWith( k, 'title' ) ) {
if ( isUndefined( v ) || v === '' ) {
delete out[ k ];
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.

@gururaj1512 What is the rationale for explicitly deleting the field here from the object?

Doing this is not great for perf, so we want to ensure we have a good reason for using delete.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

delete out[ k ];

changed with

out[ k ] = void 0;

Vega's compiler assumes the property is manually overridden and disables its internal, orientation-dependent auto-positioning/auto-aligning algorithms (even if it is a signal reference that evaluates to undefined or null).
Hence, To let the Vega engine automatically compute, the properties must be completely removed.

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.

Thanks for explaining.

event.property === 'height' ||
event.source === 'padding'
event.source === 'padding' ||
( event.property && startsWith( event.property, 'title' ) )
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.

Why do we need to push a fresh specification for title changes?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I came across abnormal behaviour. When a property titleAngle, titleBaseline, titleX & titleYwhen changed needs to be refreshed first time and after they behave as intended and do not need refreshing.
See:

screen-recording-2026-06-04-at-43507-pm_nsScXjID.mp4

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.

Hmm...it's possible that there is something going on with Vega's layout engine. This could also be a bug in Vega.

Comment thread lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/plot/vega/editor-config/axis/lib/main.js
Comment thread lib/node_modules/@stdlib/plot/vega/editor-config/axis/lib/main.js
Comment thread lib/node_modules/@stdlib/plot/vega/editor-config/axis/lib/main.js
Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Left initial comments.

Comment thread lib/node_modules/@stdlib/plot/vega/editor-config/axis/lib/main.js Outdated
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Jun 5, 2026

As the CI failure is expected, I'll go ahead and merge.

@kgryte kgryte merged commit 4ab258b into stdlib-js:refactor/plot Jun 5, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants