Skip to content

Commit 77995b9

Browse files
committed
y-axis label for distribution chart and bigger height
1 parent 92c133f commit 77995b9

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/components/graphs/CountBarChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface CountBarChartProps {
88
}
99

1010
const margin = { top: 30, right: 50, bottom: 60, left: 50 }; // Increased bottom margin for rotated labels
11-
const height = 300 - margin.top - margin.bottom;
11+
const height = 380 - margin.top - margin.bottom;
1212

1313
const CountBarChart = ({ column, realData }: CountBarChartProps) => {
1414
const svgRef = useRef<SVGSVGElement>(null);

src/components/graphs/DistributionBarChart.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ interface DistributionBarChartProps {
99
syntheticData: (string | number)[];
1010
}
1111

12-
const margin = { top: 30, right: 50, bottom: 60, left: 50 }; // Increased bottom margin for rotated labels
13-
const height = 300 - margin.top - margin.bottom;
12+
const margin = { top: 30, right: 50, bottom: 60, left: 80 }; // Increased bottom margin for rotated labels
13+
const height = 380 - margin.top - margin.bottom;
1414

1515
const DistributionBarChart = ({
1616
column,
@@ -166,6 +166,15 @@ const DistributionBarChart = ({
166166
.style('font-weight', 'bold')
167167
.text(`${t('distribution.distributionFor')} ${column}`);
168168

169+
// Add y-axis label
170+
svg.append('text')
171+
.attr('transform', 'rotate(-90)')
172+
.attr('y', -50) // Adjust position from left edge
173+
.attr('x', -plotHeight / 2) // Center vertically
174+
.attr('text-anchor', 'middle')
175+
.attr('font-size', '12px')
176+
.text(t('distribution.percentage'));
177+
169178
// Add legend
170179
const legend = svg
171180
.append('g')

src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"countFor": "Distribution for",
148148
"frequency": "Frequency",
149149
"syntheticData": "Synthetic data",
150-
"realData": "Real data"
150+
"realData": "Real data",
151+
"percentage": "Percentage of dataset"
151152
}
152153
}

src/locales/nl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
"countFor": "Distributie voor",
147147
"frequency": "Frequentie",
148148
"syntheticData": "Synthetische data",
149-
"realData": "Echte data"
149+
"realData": "Echte data",
150+
"percentage": "Percentage van dataset"
150151
}
151152
}

0 commit comments

Comments
 (0)