Skip to content

Commit

Permalink
feat(radar): add default legend for radar with #201
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed May 7, 2020
1 parent 0db2671 commit 5f9c203
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class LedgeTechRadarComponent implements OnInit, OnChanges {
items: any[],
}[] = [];
currentLevel = 0;
private customAxisLabels: any[] = [];

constructor() {
}
Expand All @@ -44,6 +45,7 @@ export class LedgeTechRadarComponent implements OnInit, OnChanges {
for (const item of this.data.slice(0, 4)) {
const items = [];
this.currentLevel = 0;
this.customAxisLabels = [];
for (const levelList of item.children) {
const level = this.getLevelByName(levelList.name);
if (levelList.children) {
Expand Down Expand Up @@ -81,6 +83,7 @@ export class LedgeTechRadarComponent implements OnInit, OnChanges {
default:
this.currentLevel++;
}
this.customAxisLabels.push(name);

return this.currentLevel;
}
Expand All @@ -89,7 +92,7 @@ export class LedgeTechRadarComponent implements OnInit, OnChanges {
const chartElement = this.chartEl.nativeElement;

// based on: https://cofinpro.github.io/Tech-Radar/
let axisLabels = ['', 'Adopt', 'Trail', 'Assess', 'Hold'].reverse();
let axisLabels = [''].concat(this.customAxisLabels).reverse();
if (this.config && !!this.config.hiddenLegend) {
axisLabels = ['', '', '', '', ''];
}
Expand Down
2 changes: 0 additions & 2 deletions src/assets/docs/think-tank/qa.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,4 @@ config: {"legend": ["当前", "未来"], "areaColor": ["#F37C20", "#E9BD1E"]}
- 《测试驱动开发的艺术》
- 《完美软件:对软件测试的各种幻想》
- 《Fifty Quick Ideas on How to Improve Your Tests》
config: {"hiddenLegend": true}
```

0 comments on commit 5f9c203

Please sign in to comment.