You have two options--both much simpler than trying to load the data into variables:
1) Define a new relationship where you can limit the records shown in your portal to just the 13 months you want in your chart. THis may require defining a global date field or two and using an inequality such that your relationship matches only to records falling in a given range. The details depend on the data stored in this related table.
2) Do the chart from a layout based on the portal's table. From that layout, you can perform a find to limit the found set to any number of records desired and you can then use the found set as the data for your chart.
Thanks for your quick response. I'll see if I'm any more successful with one of the techniques!