Wednesday, April 9, 2014

Highstock problem with liveRedraw=true on touch devices(iOS ,Android)

I want to use liveRedraw feature of Highstock on a touch device. Unfortunately, setting liveRedraw=true doesn't seem to function properly. The graph is not updated/redrawn while my finger is moving.
So, I had a look at Highstock source code (highstock.src.js) and came up with my fixes as follow:
 onContainerTouchMove: function (e) {  
           if (/*e.touches.length === 1 || */e.touches.length === 2) {  
                this.pinch(e);  
           }  
      }  

 if (hasTouch) {  
                container.ontouchstart = function (e) {  
                     pointer.onContainerTouchStart(e);  
                     pointer.onContainerMouseDown(e);  
                };  
                container.ontouchmove = function (e) {  
                     pointer.onContainerTouchMove(e);  
                     pointer.onContainerMouseMove(e);  
                };  
                addEvent(doc, 'touchend', pointer.onDocumentTouchEnd);  
           }  

      if (chart.mouseIsDown === 'mousedown' || chart.mouseIsDown === 'touchstart') {  
                this.drag(e);  
           }  

That is it. liveRedraw should work properly  now.

No comments:

Post a Comment