'How to select individual bars in d3 bar chart and highlight the selected bar?

I'm trying to select each bar in the bar chart by adding a click event, but in my code, highlighted bars are disappearing when selected.

Please refer to my link:

stackblitz link



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source