Skip to content

Commit

Permalink
refactor:handleClickBar 가독성 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
HIITMEMARIO committed Jul 28, 2024
1 parent 8998fea commit 4caf8da
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,25 @@ const AuthorBarChart = () => {
setFilteredData(newFilteredData ?? filteredData);
setPrevData([...prevData]);
setSelectedAuthor("");
} else if (d.name === "others") {
setSelectedData([]);
tooltip.style("display", "none");
return;
}

if (d.name === "others") {
// "others" 바를 클릭할 때
setPrevData([...prevData, filteredData]);
setFilteredData(getNewFilteredData(d.names || []));
setSelectedAuthor(d.name);
} else {
// 특정 사용자를 클릭할 때
setPrevData([...prevData, filteredData]);
setFilteredData(getNewFilteredData([d.name]));
setSelectedAuthor(d.name);
setSelectedData([]);
tooltip.style("display", "none");
return;
}

// 특정 사용자를 클릭할 때
setPrevData([...prevData, filteredData]);
setFilteredData(getNewFilteredData([d.name]));
setSelectedAuthor(d.name);
setSelectedData([]);
tooltip.style("display", "none");
};
Expand Down

0 comments on commit 4caf8da

Please sign in to comment.