Simplify styles

This commit is contained in:
Adrian Rumpold
2025-07-09 11:54:49 +02:00
parent 86688519f5
commit a327f58cce
3 changed files with 12 additions and 9 deletions

View File

@@ -12,11 +12,11 @@ interface QuestionGroupChartProps {
}
function makeDot(
shape: "rect" | "circle",
g: d3.Selection<SVGGElement, unknown, null, undefined>,
dotX: number,
dotY: number
) {
const shape = config.dotShape;
if (shape === "circle") {
return g
.append("circle")
@@ -50,7 +50,7 @@ export function QuestionGroupChart({
// Group responses by category (within this group only)
const responseGroups = d3.group(groupData, (d) => d.response);
const chartHeight = 200;
const chartHeight = config.chartHeight;
const chartWidth = xScale.range()[1];
const svg = d3
@@ -74,10 +74,7 @@ export function QuestionGroupChart({
const dotY =
chartHeight - (row + 1) * (config.dotRadius * 2 + config.dotSpacing);
makeDot("rect", g, dotX, dotY).attr(
"fill",
colorScheme[response] || "#666"
);
makeDot(g, dotX, dotY).attr("fill", colorScheme[response] || "#666");
});
});
}, [groupData, responses, xScale, question]);