# Creating two dimensional array for x, y using D3.Range and use them to create y axis

I am using D3.js to create a very smooth curve and therefore I used d3.range(starts, stops,steps) function to accomplish that. Also I had to use a specific formula to generate numbers for y axis with the following code:

``````  d3.json("sample-data.json",returnLineData);

function returnLineData(error,jsonData)
{
console.log("error:",error);
/* console.log(jsonData);*/

jsonData.forEach(function(jsonData){
var lineData = d3.range(0, jsonData.spend, 100)
.map(x => [ x, jsonData.alpha * (1 - 2.71828 * (-jsonData.beta * x))] );
/*  console.log("this is the data:",lineData);*/

Metrics.push(lineData);
})
}
``````

As a result I will get the following result. I attached the initial look of the array structure as a screenshot and pasting some sample generated data. I tried to name the first index as X and the second index as Y with the code below:

`````` Metrics.push({x:lineData[0],
y:lineData[1]});
``````

But it would appear very weird. So how can I use the numbers which increments by 100 as X and the decimals as Y?

``````(2) [0, 140]
1
:
(2) [100, 141.468958512]
2
:
(2) [200, 142.937917024]
3
:
(2) [300, 144.406875536]
4
:
(2) [400, 145.875834048]
5
:
(2) [500, 147.34479256]
6
:
(2) [600, 148.813751072]
7
:
(2) [700, 150.282709584]
8
:
(2) [800, 151.751668096]
9
:
(2) [900, 153.22062660799998]
10
:
(2) [1000, 154.68958512]
11
:
(2) [1100, 156.158543632]
12
:
(2) [1200, 157.627502144]
``````

The original data before the formula is below:

``````[
{
"placement_name": "BAN_1",
"alpha": 140,
"beta": 0.0000386,
"max_x_val": 28675,
"spend": 29919
},
{
"placement_name": "BAN_2",
"alpha": 115,
"beta": 0.0000208,
"max_x_val": 32302,
"spend": 28367
},
{
"placement_name": "BAN_3",
"alpha": 91.9,
"beta": 0.0000507,
"max_x_val": 19740,
"spend": 16972
},
{
"alpha": 91.8,
"beta": 0.000029119,
"max_x_val": 25855,
"spend": 27112
},
{
"alpha": 90.3,
"beta": 0.0000281,
"max_x_val": 25793,
"spend": 23883
},
{
"alpha": 88.8,
"beta": 0.0000178,
"max_x_val": 25263,
"spend": 28401
},
{
"alpha": 47.3,
"beta": 0.000100787,
"max_x_val": 10226,
"spend": 12428
},
{
"alpha": 47.3,
"beta": 0.0000254,
"max_x_val": 25669,
"spend": 21899
},
{