I have a bit trouble to understand your question but if I understand correctly you want to select a certain date range and show that data in a graph.
If that's the case then creating a helper object (helper entity) which you will populate with your data from the range you have selected can be the solution. Then you will create the graph based on the datapoints of the helper object. This is also much better for performance since your graph will only load the data that will be shown.
I assume there is not default function for this, but you can implement custom java action to achieve this and store the values in a non persistable entity.
Java Actions for reference: https://stackoverflow.com/questions/63933494/how-to-get-list-of-months-between-two-dates-in-java
This link has the exact code which fits your case : https://www.roseindia.net/answers/viewqa/Java-Beginners/33022-list-of-all-months-between-two-dates-in-java.html