Skip to content

Commit

Permalink
Sankey release (#77)
Browse files Browse the repository at this point in the history
* Sotring added

* package.json update, pull request notes implemented

* legacy api replaced, context menu support added

* Lint fixes

* apis integration

* Updated changelog.md
  • Loading branch information
MulyukovAidar authored Feb 19, 2020
1 parent d2b84d1 commit 6b52312
Show file tree
Hide file tree
Showing 13 changed files with 7,170 additions and 5,725 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.0
* Updated APIs
* Sorting added

## 2.0.2
* Fix Sankey diagram colors

Expand Down Expand Up @@ -104,4 +108,4 @@
* Display self-connected nodes correctly.
* Option for force display all data labels
* Fixed issue when some links doesn't show if height of SVG path is less than 1
* Displaying nodes and links when graph has cycles
* Displaying nodes and links when graph has cycles
13 changes: 4 additions & 9 deletions capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,8 @@
}
},
"sorting": {
"implicit": {
"clauses": [
{
"role": "Weight",
"direction": 1
}
]
}
}
"default": {}
},
"supportsKeyboardFocus": true,
"supportsSynchronizingFilterState": true
}
12,455 changes: 6,926 additions & 5,529 deletions package-lock.json

Large diffs are not rendered by default.

86 changes: 45 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-sankey",
"version": "2.0.2",
"version": "2.1.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 All @@ -14,7 +14,7 @@
"pbiviz": "pbiviz",
"start": "pbiviz start --target es6",
"package": "pbiviz package",
"lint": "node node_modules/tslint/bin/tslint \"+(src|test)/**/*.ts\"",
"lint": "tslint -c tslint.json -p tsconfig.json --fix",
"test": "karma start",
"cert": "pbiviz --create-cert"
},
Expand All @@ -28,49 +28,53 @@
},
"homepage": "https://github.com/Microsoft/powerbi-visuals-sankey#readme",
"devDependencies": {
"@babel/polyfill": "^7.2.5",
"@types/d3": "5.5.0",
"@types/jasmine": "2.5.37",
"@types/jasmine-jquery": "1.5.28",
"@types/jquery": "2.0.41",
"@types/karma": "3.0.0",
"@types/lodash-es": "4.17.1",
"coveralls": "3.0.2",
"d3": "5.7.0",
"globalize": "0.1.0-a2",
"@types/d3": "5.7.2",
"@types/jasmine": "3.5.2",
"@types/jasmine-jquery": "1.5.33",
"@types/jquery": "3.3.31",
"@types/karma": "3.0.5",
"@types/lodash-es": "4.17.3",
"coveralls": "3.0.9",
"d3": "5.15.0",
"globalize": "1.4.2",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine": "2.5.2",
"jasmine-core": "2.5.2",
"jasmine": "3.5.0",
"jasmine-core": "3.5.0",
"jasmine-jquery": "2.1.1",
"jquery": "3.4.0",
"karma": "3.1.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-jasmine": "2.0.1",
"karma-junit-reporter": "^1.2.0",
"jquery": "^3.4.1",
"karma": "^4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.0.1",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "3.1.0",
"karma-junit-reporter": "^2.0.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript": "^3.0.13",
"karma-typescript": "4.1.1",
"karma-typescript-preprocessor": "0.4.0",
"karma-webpack": "3.0.5",
"lodash-es": "4.17.14",
"powerbi-models": "1.0.13",
"powerbi-visuals-api": "2.3.1",
"powerbi-visuals-tools": "^3.0.9",
"powerbi-visuals-utils-colorutils": "^2.1.0",
"powerbi-visuals-utils-dataviewutils": "^2.1.0",
"powerbi-visuals-utils-formattingutils": "^4.1.1",
"powerbi-visuals-utils-interactivityutils": "^5.4.0",
"powerbi-visuals-utils-svgutils": "^2.1.0",
"powerbi-visuals-utils-testutils": "^2.1.4",
"powerbi-visuals-utils-tooltiputils": "^2.1.3",
"powerbi-visuals-utils-typeutils": "^2.1.0",
"karma-webpack": "4.0.2",
"lodash-es": "4.17.15",
"powerbi-models": "1.3.1",
"powerbi-visuals-api": "^2.3.2",
"powerbi-visuals-tools": "3.1.9",
"powerbi-visuals-utils-colorutils": "^2.2.1",
"powerbi-visuals-utils-dataviewutils": "^2.2.1",
"powerbi-visuals-utils-formattingutils": "^4.5.0",
"powerbi-visuals-utils-interactivityutils": "5.6.0",
"powerbi-visuals-utils-svgutils": "^2.2.1",
"powerbi-visuals-utils-testutils": "^2.2.1",
"powerbi-visuals-utils-tooltiputils": "^2.3.1",
"powerbi-visuals-utils-typeutils": "^2.2.1",
"puppeteer": "1.5.0",
"style-loader": "0.23.1",
"ts-loader": "5.3.0",
"ts-node": "7.0.1",
"tslint": "^5.12.0",
"typescript": "^3.1.6",
"webpack": "4.26.0"
"style-loader": "1.1.3",
"ts-loader": "6.2.1",
"ts-node": "8.6.2",
"tslint": "^6.0.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.7.5",
"webpack": "4.41.5"
},
"dependencies": {
"core-js": "^3.6.4",
"serialize-javascript": "^2.1.2"
}
}
29 changes: 28 additions & 1 deletion src/behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import * as d3 from "d3";

const getEvent = (): MouseEvent => require("d3-selection").event as MouseEvent;
const getEvent = (): MouseEvent => <MouseEvent>require("d3-selection").event;

import {
SankeyDiagramLink,
Expand Down Expand Up @@ -60,6 +60,7 @@ export class SankeyDiagramBehavior implements IInteractiveBehavior {

private selectedDataPoints: SelectableDataPoint[];

// tslint:disable-next-line: function-name
public static create(): IInteractiveBehavior {
return new SankeyDiagramBehavior();
}
Expand Down Expand Up @@ -99,13 +100,39 @@ export class SankeyDiagramBehavior implements IInteractiveBehavior {
this.createAnEmptySelectedDataPoints();
}
});

this.behaviorOptions.nodes.on("contextmenu", (datum: SankeyDiagramNode) => {
const event: MouseEvent = (<MouseEvent>getEvent()) || <MouseEvent>window.event;
if (event) {
this.selectionHandler.handleContextMenu(
<any>datum,
{
x: event.clientX,
y: event.clientY
});
event.preventDefault();
}
});
}

private bindClickEventToLinks(): void {
this.behaviorOptions.links.on("click", (link: SankeyDiagramLink) => {
this.selectionHandler.handleSelection(link, getEvent().ctrlKey);
this.createAnEmptySelectedDataPoints();
});

this.behaviorOptions.links.on("contextmenu", (datum: SankeyDiagramLink) => {
const event: MouseEvent = (<MouseEvent>getEvent()) || <MouseEvent>window.event;
if (event) {
this.selectionHandler.handleContextMenu(
datum,
{
x: event.clientX,
y: event.clientY
});
event.preventDefault();
}
});
}

private bindClickEventToClearCatcher(): void {
Expand Down
Loading

0 comments on commit 6b52312

Please sign in to comment.