I just got an inspiration after searching over the internet for some time. Here is the solution I currently implement.
Firstly, it is true that the rowsource property of a chart cannot be changed programmatically at run time. However, what we can do is to set the rowsource property to be a Query object and later update this query object in VBA.
Here is part of my code.
CurrentDb.QueryDefs("myQuery").SQL = "a new query"
Me.myChart.Requery
I have set my chart's row source to a query object named "myQuery". I placed the above code in the Format event of my group header, so every time when the group header is loaded I can use the value of my group header to update the Query object.