SHARE
TWEET

Untitled

a guest Jun 20th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -------------------------------------------------------------------------  
  2.        //start working with file
  3.         <div id="D3lines"></div>
  4.         <script>
  5.  
  6.  
  7. var myMatrix = new Array(1670)
  8.          for (var i=0; i<myMatrix.length; i++){
  9.                     myMatrix[i] = twodmatrix()}
  10.          function twodmatrix(){
  11.                 var myMat = new Array(180)
  12.                 for (var i=0; i<myMat.length; i++){
  13.                     myMat[i] = new Array(90)}
  14.                 return(myMat)}
  15.         d3.text("tempanomaly_new.txt", function(data){
  16.         var text1 = d3.csv.parseRows(data).map(function(row){
  17.                 return row.map(function(value) {
  18.                 return +value;}); });
  19.             for(var i = 0; i<myMatrix.length; i++){
  20.             myMatrix[i] = text1;}
  21.             console.log(text1);});
  22.         var width = 1670;
  23.         var height = 90;
  24.         var lineGraph = d3.select("#D3lines")
  25.                 .append("svg:svg")
  26.                 .attr("width", width)    
  27.                 .attr("height", height);
  28.         for (var j1=0; j1 <= width; j1= j1+1) {
  29.          for (var j = 0; j<twodmatrix.length; j = j+ 25){
  30.             lineGraph.append("svg:line")
  31.                 .attr("x1", 25)
  32.                 .attr("y1", j)
  33.                 .attr("x2", 89)
  34.                 .attr("y2", j)
  35.                 .style("stroke", "rgb(6,120,155)")
  36.                 .style("stroke-width", 2);};
  37.  
  38.         // Using for loop to draw multiple vertical lines
  39.         for (var j=0; j <89; j=j+25) { lineGraph.append("svg:line")
  40.                             .attr("x1", j)
  41.                             .attr("y1", 25)
  42.                                 .attr("x2", j)
  43.                             .attr("y2", 179)
  44.                             .style("stroke", "rgb(6,120,155)")
  45.                     .style("stroke-width", 2);};};
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top