0
Before you plot the graph, you have to think about how and what it will show, because a graph is based on values, that is, it is a visual representation of values passed by the user, data from request HTTP, or even a file JSON.
You get the data, the first thing you should do is, manipulate it so it’s in the form you want it to be on the chart. Example:
- If you have data that represent a 24 hour period, but just want to show from 13:00 to 17:00. You must filter this data from the original object, generate a new object with the data you want and then move to the graph, thus showing only what you want.
- Following the reasoning of your question, if you want to present only the first 10 months, based on the current month (11), you should then filter the original object/array and take only the data of the first 10 months and then move to the graph. Because it doesn’t make sense to make these filters on the chart itself, unless you want interaction with the user, making it able to see month 11 by clicking on some button, for example.
In conclusion, first assemble your entire strategy, since how will be the graph, the type of it, how it will be visualized and later you will take the data, filter them and then move to the graph.
I hope I’ve helped.