Ver Fonte

Fix bug in heatmap update

Lucas de Souza há 5 anos atrás
pai
commit
e380f5a0e1
4 ficheiros alterados com 8 adições e 6 exclusões
  1. 1 1
      dist/line_heatmap.js
  2. 1 1
      dist/line_heatmap.js.map
  3. 2 2
      src/heatContainer.js
  4. 4 2
      src/lineHeatmap.js

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
dist/line_heatmap.js


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
dist/line_heatmap.js.map


+ 2 - 2
src/heatContainer.js

@@ -3,7 +3,6 @@ import "nouislider";
 
 const template = `<div>
   <div class="line-heatmap-controls">
-    <p>Cade o tempo no log?</p>
     <div id="line-heatmap-slider"></div>
   </div>
   <div id="line-heatmap-canvas">
@@ -51,12 +50,13 @@ function init (elementId, logString) {
 function updateLogString (logString) {
   const logData = logTransform(logString);
   stateObject['data'] = logData;
-  stateObject['heatmap'].noUiSlider.updateOptions({
+  stateObject['slider'].noUiSlider.updateOptions({
     range: {
         'min': 1,
         'max': logData.length
     }
   });
+  stateObject['heatmap'].setTrackData(logData); 
 }
 
 function logTransform (logString) {

+ 4 - 2
src/lineHeatmap.js

@@ -17,8 +17,10 @@ export default class LineHeatmap {
   }
 
   setTrackData (data) {
-    data.forEach(point => {
-      this.heatmap.addData(point);
+    this.heatmap.setData({
+      max: Number.MAX_SAFE_INTEGER,
+      min: 0,
+      data: data
     });
   }
 }