Try to build pivot chart in the proper way

I am trying to build a pivot chart like

I have these data:

year Sex Quantity
1880 F 7065
M 2604
1881 M 2003
F 2000
The problem is that I can’t build this chart in the proper way like in the picture. Maybe I should do the pivot table with two categories:year and sex, but I don’t know how.