|
|
@@ -37,19 +37,20 @@ export class YearGraphComponent {
|
|
|
const regionData = this.sdmDihService.sdmData[this.selectedYear].find(
|
|
|
(row) => row['MODEL'] === region
|
|
|
);
|
|
|
- const width = 200;
|
|
|
- const height = 200;
|
|
|
- //select("#year-graph-place").select("svg")?.remove();
|
|
|
+ const width = 100 / this.regions.length;
|
|
|
+ const height = 100 / this.regions.length;
|
|
|
// append the svg object to the div called 'year-graph-place'
|
|
|
const svg = select('#year-graph-place')
|
|
|
.append('svg')
|
|
|
- .attr('width', width)
|
|
|
- .attr('height', height)
|
|
|
+ .attr('width', `${width}%`)
|
|
|
+ .attr('height', `${height}%`)
|
|
|
+ .append('svg')
|
|
|
+ .attr('x', '50%')
|
|
|
+ .attr('y', '50%')
|
|
|
+ .attr('overflow', 'visible')
|
|
|
.append('g')
|
|
|
- .data([regionData])
|
|
|
- .attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
|
|
|
- //const yearData = this.sdmDihService.aggregatedData[this.selectedYear];
|
|
|
- //const color = `rgba(100, 200, 100, ${yearData[0]['Natural_Capital']})`;
|
|
|
+ .data([regionData]);
|
|
|
+ //.attr('transform', 'translate(' + width / 2 + '% ,' + height / 2 + '% )');
|
|
|
svg
|
|
|
.append('circle')
|
|
|
.attr('cx', 0)
|
|
|
@@ -62,10 +63,11 @@ export class YearGraphComponent {
|
|
|
});
|
|
|
svg
|
|
|
.append('text')
|
|
|
- .attr('x', 50)
|
|
|
- .attr('y', 50)
|
|
|
+ .attr('x', 0)
|
|
|
+ .attr('y', -60)
|
|
|
.attr('dy', '.35em')
|
|
|
- .text((d) => d['MODEL']);
|
|
|
+ .text((d) => d['MODEL'])
|
|
|
+ .style('text-anchor', 'middle');
|
|
|
}
|
|
|
|
|
|
redrawGraphs() {
|