Skip to content

Looks like the CSV doesn't get loaded in time (sometimes) #32

@shantderder

Description

@shantderder

Getting a bunch of unreferenced slatlong errors (specifically on chrome), seemingly at random. looks sort of like an async issue?

adding d3-queue.v3.min.js and tossing all the good bits into a deferred queue seems to fix this

      d3.queue()
        .defer(d3.csv, "assets/csv/samplatlong.csv")
        .defer(d3.tsv, "assets/csv/country_centroids_primary.csv")
        .await(analyze);
      function analyze(error, slatlong, centers) {
        if(error) { console.log(error); }

        else {
           console.log("COORDINATES RECEIVED");
          var attacks = {
            interval: getRandomInt(attack_min, attack_max),
            init: function(){
              setTimeout(
                  jQuery.proxy(this.getData, this),
                  this.interval
              );
            },
          getData: function() {
    . . . . etcetc 
     attacks.init();
     } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions