CityBrainChallenge / KDDCup2021-CityBrainChallenge-starter-kit

76 stars 40 forks source link

yarn start can't demostrate the visualizaton #3

Closed stellarkey closed 3 years ago

stellarkey commented 3 years ago

There is no error messages.

image

But I fail to open the website " http://localhost:3000/".

image

stellarkey commented 3 years ago

The modified codes are as follows:

...
...
mapboxgl.accessToken = 'pk.eyJ1IjoidmVsb2NmYyIsImEiOiJja24zNjNkd3IxZWFjMndvOHh6M2F0dDM3In0.wyUaKKx5Ilq4QBsFh6WIxA';

class Application extends React.Component {
  mapRef = React.createRef();
  map;
  constructor(props: Props) {
    super(props);
    this.state = { clocker: 0, paused: true, code: '' };
    this.maxTime = 359
    this.trafficpos = require("./log/lightinfo.json")
    this.roadpos = require("./log/roadinfo.json")
    this.ClickStart = this.ClickStart.bind(this);
    this.ClickPause = this.ClickPause.bind(this);
    this.ClickRestart = this.ClickRestart.bind(this);
    this.ClickReset = this.ClickReset.bind(this);
    this.onChange = this.onChange.bind(this);
    setInterval(() => { this.upDate(this.map) }, 100);
  }
...
...
zhyliu00 commented 3 years ago

Thanks for your comment. Can you provide your environment?

stellarkey commented 3 years ago

Thanks for reply. I'm using VSCode internal terminal to create a virtual docker environment to run the starter-kit on Window 10.

zhyliu00 commented 3 years ago

Thanks for your feedback. The visualization tool is independent from the experiment package. Therefore, you can directly run "yarn start" and go to localhost:3000 in your browser both on your Windows computer. It seems the error might be induced by running the "yarn start" in the docker container while openning the browser on the host machine.

stellarkey commented 3 years ago

Thanks for your suggestions! It worked! I run it directly through the terminal and the localhost:3000 auto-pop out and demostrate everything well.