Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data labels and weight with zero values #208

Merged
merged 2 commits into from
Sep 24, 2024
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
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
Loading