# Range layout not working

**URL:** <https://community.plotly.com/t/range-layout-not-working/7452>\
**Category:** plotly.js\
**Created:** [December 22, 2017, 5:03pm UTC](https://community.plotly.com/t/range-layout-not-working/7452 "2017-12-22T17:03:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://community.plotly.com/u/ahmed)\
**Post date:** [December 22, 2017, 5:03pm UTC](https://community.plotly.com/t/range-layout-not-working/7452/1 "2017-12-22T17:03:37Z")

</div>

Hi,  
I would like to show data from the first date and the last selected from the list :  
Here is my code

```
var listx = [];
var listy = [];
var frst = end = 0;
fetch('http://api.openweathermap.org/data/2.5/forecast?lat=59.9199&lon=10.6341&units=metric&APPID=e8e9c42c251d963d12895024279a2bb8')
    .then(res => res.json())
    .then((out) => {
        //console.log('Output: ', out.list);
        var myMessage = out.list;
        
		for (var i = 0; i < myMessage.length; i++) {
		    //console.log('Output: ', myMessage[i]);
		    frst= Date.parse(myMessage[0].dt_txt)/1000;
		    end=Date.parse(myMessage[myMessage.length -1].dt_txt)/1000;
		    listx.push( myMessage[i].dt_txt);
		    listy.push( myMessage[i].main.temp);
		}
		alert(st);
		alert(end);
		console.log(listx);
		console.log(listy);
}).catch(err => console.error(err));

var layout = {
  title: 'Custom Range',
  xaxis: {
    range: [frst, end],
    type: 'date'
  },
  yaxis: {
    autorange: true,
    range: [-10, 10],
    type: 'linear'
  }
};
var data = [
  {
    x: listx,
    y: listy, //[1, 3, 6],
    type: 'scatter'
  }
];
console.log(data);
Plotly.plot('myDiv', data, layout);

```

I have tried also this

> document.querySelector(‘[data-title=“Autoscale”]’).click()

but doesn’t work …  
Even unix time in range not working … where is the prob ?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [December 22, 2017, 6:32pm UTC](https://community.plotly.com/t/range-layout-not-working/7452/2 "2017-12-22T18:32:45Z")

</div>

> [@ahmed](#):
>
> Even unix time in range not working … where is the prob ?

They should work. Would you mind sharing bits of your data to help us debug?

---

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://community.plotly.com/u/ahmed)\
**Post date:** [December 27, 2017, 3:49pm UTC](https://community.plotly.com/t/range-layout-not-working/7452/3 "2017-12-27T15:49:23Z")

</div>

use can find data here:  
[http://api.openweathermap.org/data/2.5/forecast?lat=59.9199&lon=10.6341&units=metric&APPID=e8e9c42c251d963d12895024279a2bb8](http://api.openweathermap.org/data/2.5/forecast?lat=59.9199&lon=10.6341&units=metric&APPID=e8e9c42c251d963d12895024279a2bb8)
