Is there any way to specify the 'Data Range' for a graph, using an IF formula (or otherwise), based on the value in another cell?

My graph data is contained within cells B17:P19. If the value in cell A1 = 'Region', then I only want my graph to plot the data within B17:F19, however, if the value in cell A1 changes to 'Area', I want to plot the data/replace the existing data with the values in G17:P19.

Is this possible and if so, how would I go about doing this?