Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 30th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Playing around with WebGL and Canvas, but having some difficulties changing data in JSON file
  2. [
  3.     'seriesA', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
  4.   ],
  5.   [
  6.     'seriesB', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
  7. ]
  8.        
  9. xhr = new XMLHttpRequest();
  10.  xhr.open('GET', '/globe/test.json', true);
  11.   xhr.onreadystatechange = function(e) {
  12.     if (xhr.readyState === 4) {
  13.       if (xhr.status === 200) {
  14.         var data = JSON.parse(xhr.responseText);
  15.         window.data = data;
  16.         for (i=0;i<data.length;i++) {
  17.           globe.addData(data[i][1], {format: 'magnitude', name: data[i][0], animated: true});
  18.         }
  19.         globe.createPoints();
  20.         settime(globe,0)();
  21.         globe.animate();
  22.       }
  23.     }
  24.   };
  25.   xhr.send(null);