|
|
@@ -33,7 +33,7 @@ export class DiscLegendComponent implements OnInit, AfterViewInit {
|
|
|
drawLegend(): void {
|
|
|
//select(`#graph-legend-place`).remove();
|
|
|
const width = 200;
|
|
|
- const height = 20;
|
|
|
+ const height = 40;
|
|
|
const g = select(`#${this.divId}`)
|
|
|
.append('svg')
|
|
|
.attr('width', width)
|
|
|
@@ -42,13 +42,14 @@ export class DiscLegendComponent implements OnInit, AfterViewInit {
|
|
|
.style('overflow', 'visible')
|
|
|
.style('display', 'block')
|
|
|
.append('g');
|
|
|
- for (let i = 0; i < 10; i++) {
|
|
|
+ const PIECES = 20;
|
|
|
+ for (let i = 0; i < PIECES; i++) {
|
|
|
g.append('rect')
|
|
|
- .attr('x', i * 20)
|
|
|
+ .attr('x', i * (width / PIECES))
|
|
|
.attr('y', 0)
|
|
|
- .attr('width', width / 10)
|
|
|
- .attr('height', height / 2)
|
|
|
- .attr('fill', this.sdmDihService.perc2color(i / 10));
|
|
|
+ .attr('width', width / PIECES)
|
|
|
+ .attr('height', height / 3)
|
|
|
+ .attr('fill', this.sdmDihService.perc2color(i / PIECES));
|
|
|
}
|
|
|
g.append('text')
|
|
|
.attr('x', 0 - 10)
|
|
|
@@ -56,9 +57,19 @@ export class DiscLegendComponent implements OnInit, AfterViewInit {
|
|
|
.attr('dy', '.5em')
|
|
|
.text('0 %');
|
|
|
g.append('text')
|
|
|
- .attr('x', 200 - 10)
|
|
|
+ .attr('x', 0 - 10)
|
|
|
+ .attr('y', height)
|
|
|
+ .attr('dy', '.5em')
|
|
|
+ .text('(least attractive)');
|
|
|
+ g.append('text')
|
|
|
+ .attr('x', 200 - 20)
|
|
|
.attr('y', 20)
|
|
|
.attr('dy', '.5em')
|
|
|
.text('100 %');
|
|
|
+ g.append('text')
|
|
|
+ .attr('x', 200 - 20)
|
|
|
+ .attr('y', height)
|
|
|
+ .attr('dy', '.5em')
|
|
|
+ .text('(most attractive)');
|
|
|
}
|
|
|
}
|