Simplify styles
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user