Show only one selected data and no overlayying as shown on the figure

Hi, if we have more than one element, how to let the chart to show only one element of the histogram data and able to click one selection only on the legend side at the same time? so the histogram always show one element only depends on the legend selected and the legend side cannot multiselect.