Skip to content

Commit

Permalink
Merge pull request #109 from unipept/fix/add-reset
Browse files Browse the repository at this point in the history
Add reset function to Treeview and Treemap
  • Loading branch information
pverscha authored Mar 31, 2022
2 parents a9d7026 + f9d45e1 commit 774e4e7
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 19 deletions.
13 changes: 1 addition & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,4 @@ jobs:
- name: Install Jest CLI
run: npm i -g jest-cli
- name: Run tests
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
test-command: "jest"
coverage-comment: false
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: snapshots
path: test
run: npm run test
1 change: 1 addition & 0 deletions dist/transition/__tests__/Transition.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
4 changes: 2 additions & 2 deletions dist/unipept-visualizations.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/utilities/__tests__/NodeUtils.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/utilities/__tests__/StringUtils.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/utilities/__tests__/TooltipUtilities.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/visualizations/heatmap/__tests__/Heatmap.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/visualizations/sunburst/__tests__/Sunburst.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/visualizations/treemap/Treemap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class Treemap {
private nodeId;
constructor(element: HTMLElement, data: DataNodeLike, options?: TreemapSettings);
resize(newWidth: number, newHeight: number): void;
reset(): void;
private fillOptions;
private initCss;
private render;
Expand Down
1 change: 1 addition & 0 deletions dist/visualizations/treemap/__tests__/Treemap.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/visualizations/treeview/Treeview.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class Treeview {
private zoomScale;
private svg;
constructor(element: HTMLElement, data: DataNodeLike, options?: TreeviewSettings);
reset(): void;
private fillOptions;
private render;
private centerRoot;
Expand Down
4 changes: 2 additions & 2 deletions examples/treeview-taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- D3 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/6.2.0/d3.min.js"></script>

<!-- Visualiations -->
<!-- Visualisations -->
<script src="../dist/unipept-visualizations.js"></script>
</head>

Expand All @@ -22,7 +22,7 @@
width: 900,
height: 600
}
)
);
});
</script>
</body>
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
Expand Up @@ -7,7 +7,7 @@
"main": "dist/unipept-visualizations.js",
"typings": "./types",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest src/.*/.*.spec.ts",
"build": "webpack",
"types": "tsc --emitDeclarationOnly --downlevelIteration --declaration src/**/*.ts --outDir types --target esnext --skipLibCheck"
},
Expand Down
4 changes: 4 additions & 0 deletions src/visualizations/treemap/Treemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export default class Treemap {
this.render(this.currentRoot, false);
}

public reset() {
this.render(this.data[0], false);
}

private fillOptions(options: any = undefined): TreemapSettings {
const output = new TreemapSettings();
return Object.assign(output, options);
Expand Down
4 changes: 4 additions & 0 deletions src/visualizations/treeview/Treeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export default class Treeview {
this.render(this.root);
}

public reset() {
this.render(this.data[0]);
}

private fillOptions(options: any = undefined): TreeviewSettings {
const output = new TreeviewSettings();
return Object.assign(output, options);
Expand Down

0 comments on commit 774e4e7

Please sign in to comment.