How do I plot a bar chart where i can select the x variable and y variable

Can you provide a reproducible example?