Skip to content
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

## 8.1.0

* Added `fontWeight`, `fontStyle`, `textDecoration` to `LegendData` interface
* Added `fontWeight`, `fontStyle`, `textDecoration` to `LabelOld` interface
* Updated packages

## 8.0.0

### Module `axis`
Expand Down
790 changes: 471 additions & 319 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-utils-chartutils",
"version": "8.0.0",
"version": "8.1.0",
"description": "ChartUtils",
"main": "lib/index.js",
"module": "lib/index.js",
Expand Down Expand Up @@ -35,16 +35,16 @@
"devDependencies": {
"@types/d3-array": "^3.2.1",
"@types/d3-axis": "^3.0.6",
"@types/d3-scale": "^4.0.8",
"@types/d3-scale": "^4.0.9",
"@types/d3-selection": "^3.0.11",
"@types/d3-transition": "^3.0.9",
"@types/jasmine": "^5.1.4",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@types/jasmine": "^5.1.7",
"@typescript-eslint/eslint-plugin": "^8.31.0",
"@typescript-eslint/parser": "^8.31.0",
"coverage-istanbul-loader": "3.0.5",
"eslint": "^9.13.0",
"eslint": "^9.25.1",
"eslint-plugin-powerbi-visuals": "^1.0.0",
"jasmine": "5.4.0",
"jasmine": "5.6.0",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage": "^2.2.1",
Expand All @@ -53,16 +53,16 @@
"karma-sourcemap-loader": "^0.4.0",
"karma-typescript": "^5.5.4",
"karma-webpack": "5.0.1",
"less": "^4.2.0",
"less": "^4.3.0",
"lodash.union": "4.6.0",
"playwright-chromium": "^1.48.2",
"playwright-chromium": "^1.52.0",
"powerbi-visuals-api": "^5.11.0",
"powerbi-visuals-utils-colorutils": "^6.0.5",
"powerbi-visuals-utils-testutils": "^6.1.1",
"ts-loader": "^9.5.1",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"typescript": "^5.5.0",
"webpack": "^5.96.1"
"typescript": "^5.8.3",
"webpack": "^5.99.6"
},
"dependencies": {
"d3-array": "^3.2.4",
Expand All @@ -73,7 +73,7 @@
"powerbi-visuals-utils-formattingutils": "^6.1.2",
"powerbi-visuals-utils-svgutils": "^6.0.4",
"powerbi-visuals-utils-typeutils": "^6.0.3",
"typescript-eslint": "^8.12.2"
"typescript-eslint": "^8.31.0"
},
"optionalDependencies": {
"fsevents": "2.3.3"
Expand Down
1 change: 1 addition & 0 deletions src/label/fontProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface FontProperties {
readonly variant?: string;
readonly weight?: string;
readonly whiteSpace?: string;
readonly decoration?: string;
}

export interface MutableFontProperties {
Expand Down
9 changes: 9 additions & 0 deletions src/label/labelLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,15 @@ export interface LabelOld extends ISelectableDataPoint{
/** A text anchor used to override the default label text-anchor (middle) */
textAnchor?: string;

/** The font weight of the data label */
fontWeight?: string;

/** The font style of the data label */
fontStyle?: string;

/** The text decoration of the data label */
textDecoration?: string;

/** points for reference line rendering */
leaderLinePoints?: number[][];

Expand Down
9 changes: 6 additions & 3 deletions src/label/labelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ export function downgradeToOldLabels(labels: Label[]): LabelOld[] {
const inheritedLabel: Label = { ...label };
inheritedLabel.fontProperties = null;
const oldLabel: LabelOld = <any>inheritedLabel;
oldLabel.fill = label.fontProperties ? label.fontProperties.color : undefined;
oldLabel.fontSize = (label.fontProperties && label.fontProperties.size) ? label.fontProperties.size.pt : undefined;
oldLabel.fontFamily = label.fontProperties ? label.fontProperties.family : undefined;
oldLabel.fill = label?.fontProperties?.color;
oldLabel.fontSize = label?.fontProperties?.size?.pt;
oldLabel.fontFamily = label?.fontProperties?.family;
oldLabel.fontWeight = label?.fontProperties?.weight;
oldLabel.fontStyle = label?.fontProperties?.style;
oldLabel.textDecoration = label?.fontProperties?.decoration;
return oldLabel;
});
}
Expand Down
5 changes: 4 additions & 1 deletion src/label/newDataLabelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export function drawDefaultLabels(
.style("fill", (d: LabelOld) => d.fill)
.style("font-size", (d: LabelOld) => pixelConverter.fromPoint(d.fontSize || DefaultLabelFontSizeInPt))
.style("font-family", (d: LabelOld) => d.fontFamily ? d.fontFamily : undefined)
.style("text-anchor", (d: LabelOld) => d.textAnchor);
.style("text-anchor", (d: LabelOld) => d.textAnchor)
.style("font-weight", (d: LabelOld) => d.fontWeight)
.style("font-style", (d: LabelOld) => d.fontStyle)
.style("text-decoration", (d: LabelOld) => d.textDecoration)

if (hasTooltip) {
labels.append("title").text((d: LabelOld) => d.tooltip);
Expand Down
6 changes: 6 additions & 0 deletions src/legend/legendInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export interface LegendData {
labelColor?: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: string;
fontStyle?: string;
textDecoration?: string;
}

export const legendProps = {
Expand All @@ -93,6 +96,9 @@ export const legendProps = {
showTitle: "showTitle",
labelColor: "labelColor",
fontSize: "fontSize",
fontWeight: "fontWeight",
fontStyle: "fontStyle",
textDecoration: "textDecoration",
};

export interface ILegend {
Expand Down
8 changes: 7 additions & 1 deletion src/legend/svgLegend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ export class SVGLegend implements ILegend {
.style("fill", data.labelColor)
.style("font-size", PixelConverter.fromPoint(data.fontSize))
.style("font-family", data.fontFamily)
.style("font-weight", data.fontWeight)
.style("font-style", data.fontStyle)
.style("text-decoration", data.textDecoration)
.text((d: TitleLayout) => d.text)
.attr("x", (d: TitleLayout) => d.x)
.attr("y", (d: TitleLayout) => d.y)
Expand Down Expand Up @@ -392,7 +395,10 @@ export class SVGLegend implements ILegend {
.text((d: LegendDataPoint) => d.label)
.style("fill", data.labelColor)
.style("font-size", PixelConverter.fromPoint(data.fontSize))
.style("font-family", data.fontFamily);
.style("font-family", data.fontFamily)
.style("font-weight", data.fontWeight)
.style("font-style", data.fontStyle)
.style("text-decoration", data.textDecoration);

legendItems
.exit()
Expand Down
Loading