# How to create a dynamic range for x axis using Google Charts 0-99,100-199... depending on the max value?

I need to build a graph using Google Charts based on the information that I have in my array. The issue is than i do not understand how to start making it because I do not have any idea how to build the x-axis.

My array:

``````0: Shopping {name: "pedro", desc: "", amount: 1250, …}
1: Shopping {name: "marie", desc: "", amount: 250, …}
2: Shopping {name: "fia", desc: "", amount: 270, …}
...
``````

In the x-axis, is going to have the range of the amounts that starts from 0-99, 100-199.. to the max value that exist in my whole array called Shopping. For example like in the case that I have in my array, now the max value seems to be 1250, so the range in the x-axis have to go from 0-99, 100-199, 200-299... to 1200-1299 that is my latest range.

In the y-axis, I have the quantity of how many values from the amount are in that range, for example the array shopping key one and two, are in the range in 200-299, so the bar is going to go to the number 2, and the array shopping key cero is going to go to the number 1 because only exist an amount that belongs in the range 1200-1299

Does anyone know how to do it? I was thinking on counting the length of the amount and then minus -1. So I will have two numbers in the case that the amount would be 438, and then i will see which is the first number and try to loop and create arrays Rows. I did not try to run this idea because i still do not understand how to create arrays for data.addRows for Google Charts.

I can not use Jquery. If anyone can explain me how it would be the code or which is the solution for me, i will be totally greatful. Thanks.