Skip to content

Added new legend positions#136

Open
kullJul wants to merge 4 commits into
microsoft:mainfrom
kullJul:dev/v-ikulagina/add-new-legend-positions
Open

Added new legend positions#136
kullJul wants to merge 4 commits into
microsoft:mainfrom
kullJul:dev/v-ikulagina/add-new-legend-positions

Conversation

@kullJul
Copy link
Copy Markdown
Contributor

@kullJul kullJul commented May 12, 2026

Module legend

  • Added LegendPosition.TopRight and LegendPosition.BottomRight — horizontal legend with items right-aligned to the chart area; falls back to left-aligned with a navigation arrow on overflow.
  • Added matching legendPosition string constants topRight and bottomRight.
  • Exported orientation helpers: isLeft, isRight, isTop, isBottom, isTopOrBottom, isCentered, isRightAligned. isTop/isBottom now also match the new right-aligned variants.
  • Fixed clipping of vertical centered legends (LeftCenter/RightCenter) when items overflowed (missing Math.max(0, ...) clamp).

@kullJul kullJul requested a review from Copilot May 12, 2026 14:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new right-aligned horizontal legend placements and refactors/shared orientation helpers, aligning behavior with native Power BI legend layout (including overflow handling) while fixing a centered-vertical clipping issue.

Changes:

  • Added LegendPosition.TopRight / LegendPosition.BottomRight plus matching legendPosition string constants.
  • Exported orientation helper functions (isRight, isBottom, isTopOrBottom, isCentered, isRightAligned, etc.) and updated SVGLegend to use them.
  • Fixed centered vertical legend overflow translation by clamping the computed offset to >= 0.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/legend/svgLegend.ts Adds right-aligned horizontal rendering/overflow fallback and uses shared orientation helpers; fixes vertical centered overflow clipping.
src/legend/legendPosition.ts Adds topRight / bottomRight string constants.
src/legend/legendInterfaces.ts Extends LegendPosition enum with TopRight / BottomRight.
src/legend/legend.ts Exports additional orientation helper functions and expands isTop/isBottom to include right-aligned variants.
package.json Bumps package version to 8.3.0.
package-lock.json Updates lockfile version metadata and transitive dependency resolution entries.
CHANGELOG.md Adds 8.3.0 release notes describing the legend changes.
.github/workflows/release.yml Renames the workflow (Release Buildrelease).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/legend/svgLegend.ts Outdated
Comment thread src/legend/svgLegend.ts
Comment thread src/legend/svgLegend.ts
Comment thread .github/workflows/release.yml
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