2016-04-07 20 views

回答

1

沒有專門的事件。但是,您可以通過使用JavaScript通用事件mouseup/touchend來實現該功能,以捕獲平底鍋何時結束。 I .: .:

"listeners": [{ 
    /** 
    * rendered event 
    * we'll use it to set up custom mouse events as well as 
    * pre-zoom the chart 
    */ 
    "event": "rendered", 
    "method": function(e) { 

     // add mouseup events 
     e.chart.chartDiv.addEventListener("mouseup", handleEnd); 
     e.chart.chartDiv.addEventListener("touchend", handleEnd); 

     // function that handles pan end (mouse button released or touch ends) 
     function handleEnd() { 

     // check if there was an previous zoom event 
     if (e.chart.lastZoomedEvent === undefined) 
      return; 

     // do what we need to do with it 
     // ... 
     console.log(e.chart.lastZoomedEvent); 

     // reset 
     e.chart.lastZoomedEvent = undefined; 
     } 

     // pre-zoom the chart 
     e.chart.zoomToIndexes(
     e.chart.dataProvider.length - 40, 
     e.chart.dataProvider.length - 1); 
    } 
    }, { 
    /** 
    * zoomed event 
    * we'll use it to track pan/zoom 
    */ 
    "event": "zoomed", 
    "method": function(e) { 
     // log last zoomed event 
     e.chart.lastZoomedEvent = e; 
    } 
    }] 

這是working demo