Ascending (Descending) order in Bar and Pie Charts

Dear All,

How can I obtain a Bar Chart where the output is such that the values are ordered in the x-axis by the number of counts (shown in the y-axis) ? And for the Pie Chart, something similar, ordered by number of counts.

Thank you.