Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Release Build
name: release

Comment thread
kullJul marked this conversation as resolved.
on:
release:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Changelog

## 8.3.0

### 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).

## 8.2.1

* Updated packages
Expand Down
34 changes: 25 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-utils-chartutils",
"version": "8.2.1",
"version": "8.3.0",
"description": "ChartUtils",
"main": "lib/index.js",
"module": "lib/index.js",
Expand Down
48 changes: 48 additions & 0 deletions src/legend/legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,58 @@ export function isLeft(orientation: LegendPosition): boolean {
}
}

export function isRight(orientation: LegendPosition): boolean {
switch (orientation) {
case LegendPosition.Right:
case LegendPosition.RightCenter:
return true;
default:
return false;
}
}

export function isTop(orientation: LegendPosition): boolean {
switch (orientation) {
case LegendPosition.Top:
case LegendPosition.TopCenter:
case LegendPosition.TopRight:
return true;
default:
return false;
}
}

export function isBottom(orientation: LegendPosition): boolean {
switch (orientation) {
case LegendPosition.Bottom:
case LegendPosition.BottomCenter:
case LegendPosition.BottomRight:
return true;
default:
return false;
}
}

export function isTopOrBottom(orientation: LegendPosition): boolean {
return isTop(orientation) || isBottom(orientation);
}

export function isCentered(orientation: LegendPosition): boolean {
switch (orientation) {
case LegendPosition.TopCenter:
case LegendPosition.BottomCenter:
case LegendPosition.LeftCenter:
case LegendPosition.RightCenter:
return true;
default:
return false;
}
}

export function isRightAligned(orientation: LegendPosition): boolean {
switch (orientation) {
case LegendPosition.TopRight:
case LegendPosition.BottomRight:
return true;
default:
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/legend/legendInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export enum LegendPosition {
BottomCenter,
RightCenter,
LeftCenter,
TopRight,
BottomRight,
}

export interface ISelectableDataPoint{
Expand Down
2 changes: 2 additions & 0 deletions src/legend/legendPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ export const topCenter: string = "TopCenter";
export const bottomCenter: string = "BottomCenter";
export const leftCenter: string = "LeftCenter";
export const rightCenter: string = "RightCenter";
export const topRight: string = "TopRight";
export const bottomRight: string = "BottomRight";
Loading
Loading