Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

canvasXpress update data remotely

By: ilikeopensource on Aug 16th, 2012  |  syntax: JavaScript  |  size: 2.24 KB  |  views: 204  |  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. <html>
  2. <!- Thanks to author of canvasXpress (5.x) Isaac Neuhaus -!>
  3.   <head>
  4.     <title>HeatMap Example</title>
  5.     <script type="text/javascript" src="./js/canvasXpress.min.js"></script>
  6.     <script>
  7.       var gr;
  8.       var showDemo = function () {
  9.             gr = new CanvasXpress("canvas4", {
  10.  
  11.                   "y": {
  12.                     "vars": ["Gene1","Gene2","Gene3","Gene4","Gene5","Gene6","Gene7"],
  13.                     "smps": ["Smp1","Smp2","Smp3","Smp4","Smp5","Smp6","Smp7","Smp8"],
  14.                     "desc": ["Intensity"],
  15.                     "data": [
  16.                       [10,12,153,4,100,73,42,64],
  17.                       [12,4,60,5,24,14,32,13],
  18.                       [7,12,20,13,49,52,42,92],
  19.                       [21,10,30,8,65,200,47,58],
  20.                       [15,14,100,5,34,130,82,51],
  21.                       [100,82,73,124,0,4,5,142],
  22.                       [100,82,73,124,0,4,5,142]
  23.                     ]
  24.                   }
  25.                 }, {
  26.                   "graphType": "Heatmap",            
  27.                   "indicatorCenter": "rainbow",
  28.                   "heatmapType": "purple-red"
  29.                 })
  30.              
  31.      }
  32.      function update()
  33.      {
  34.          remoteData = [
  35.                           [10,12,153,4,100,73,42,64],
  36.                           [12,4,60,5,24,14,32,13],
  37.                           [7,12,20,13,49,52,42,92],
  38.                           [21,10,30,8,65,2000,47,58],
  39.                           [15,14,100,5,34,130,82,51],
  40.                           [100,82,73,124,0,4,5,142],
  41.                           [100,82,73,124,0,4,5,142]
  42.                     ];            
  43.        
  44.          newData = {
  45.  
  46.                   "y": {
  47.                     "vars": ["Gene1","Gene2","Gene3","Gene4","Gene5","Gene6","Gene7"],
  48.                     "smps": ["Smp1","Smp2","Smp3","Smp4","Smp5","Smp6","Smp7","Smp8"],
  49.                     "desc": ["Intensity"],
  50.                     "data": remoteData
  51.                   }
  52.                 };
  53.         gr.updateData(newData);        
  54.        
  55.      }
  56. </script>
  57.   </head>
  58.  
  59.   <body onload="showDemo();">
  60.         <canvas id="canvas4" width="613" height="500"></canvas>
  61.     <input type="button" value="Send" id="send-button" onclick="update();">
  62. </body>
  63. </html>