Skip to content

Commit

Permalink
Fix data labels and weight with zero values (#208)
Browse files Browse the repository at this point in the history
* Fix weight with zero values

* Increase visual version

---------

Co-authored-by: Iuliia Kulagina <[email protected]>
  • Loading branch information
kullJul and Iuliia Kulagina authored Sep 24, 2024
1 parent ddbbb86 commit b96ec2b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.4.3.0
* Fix weight with zero values

## 3.4.2.0
* Fix context menu for links and nodes

Expand Down
4 changes: 2 additions & 2 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-sankey",
"version": "3.4.2.0",
"version": "3.4.3.0",
"description": "Sankey is a type of flow diagram in which the width of the series is in proportion to the quantity of the flow. Use it to find major contributions to an overall flow.",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions pbiviz.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"visual": {
"name": "SankeyDiagram",
"displayName": "Sankey 3.4.2.0",
"displayName": "Sankey 3.4.3.0",
"guid": "sankey02300D1BE6F5427989F3DE31CCA9E0F32020",
"visualClassName": "SankeyDiagram",
"version": "3.4.2.0",
"version": "3.4.3.0",
"description": "Sankey is a type of flow diagram in which the width of the series is in proportion to the quantity of the flow. Use it to find major contributions to an overall flow.",
"supportUrl": "https://community.powerbi.com",
"gitHubUrl": "https://github.com/Microsoft/powerbi-visuals-sankey"
Expand Down
7 changes: 4 additions & 3 deletions src/sankeyDiagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type UpdateSelection<T> = d3Selection<any, T, any, any>;
// powerbi
import DataView = powerbi.DataView;
import IViewport = powerbi.IViewport;
import PrimitiveValue = powerbi.PrimitiveValue;
import DataViewObjects = powerbi.DataViewObjects;
import VisualObjectInstance = powerbi.VisualObjectInstance;
import DataViewObjectPropertyIdentifier = powerbi.DataViewObjectPropertyIdentifier;
Expand Down Expand Up @@ -156,7 +157,7 @@ export class SankeyDiagram implements IVisual {
private static DefaultFormatOfWeight: string = "g";

private static DefaultWeightValue: number = 0;
private static MinWeightValue: number = 1;
private static MinWeightValue: number = 0;

private static TooltipDisplayName: string = "Name";

Expand Down Expand Up @@ -461,7 +462,7 @@ export class SankeyDiagram implements IVisual {
dataView.matrix.rows.root.children.forEach(parent => {
const foundSource: SankeyDiagramNode = nodes.find(found => found.label.name === parent.value)
parent.children.forEach(child => {
let linkLabel = undefined;
let linkLabel: PrimitiveValue = undefined;
let weight: number = SankeyDiagram.DefaultWeightValue;

let foundDestination: SankeyDiagramNode = nodes.find(found => found.label.name === child.value)
Expand Down Expand Up @@ -509,7 +510,7 @@ export class SankeyDiagram implements IVisual {
);

const link: SankeyDiagramLink = {
label: linkLabel && linkLabel.toString(),
label: linkLabel?.toString(),
source: foundSource,
destination: foundDestination,
weight: weight,
Expand Down

0 comments on commit b96ec2b

Please sign in to comment.