简体   繁体   中英

javascript/D3 quirk?

var t =  g.on("click", function(d) {
      return data_series_1[d.iata]["EV"];
      });

   // So data_series_1 is an array of arrays.
   // d.iata = "BOS"
   // data_series_1[d.iata]["EV"] or
   // data_series_1["BOS"]["EV"] = "68"

However for some reason t is defined to be an array of length 80 or array[80] with each element being 0: g, 1: g, and so on...

Can someone explain what is going on and why I am not able to get a mapping of t = 68?

var t;
g.on("click", function(d) {
    t = data_series_1[d.iata]["EV"];
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM